title: Are there semicolon insertion dangers with continuing operators on next line?
body: <p>Historically, I like to break expressions so that the "it's clearly incomplete" bias is shown on the continued line:</p>
  
  <pre><code>var something = foo + bar
      + baz(mumble);
  </code></pre>
  
  <p>This is an attitude that comes from working in languages which need semicolons to terminate expressions. The first line is already <em>obviously</em> incomplete due to no-semicolon, so it's better to make it clear to the reader that the second line is not complete.</p>
  
  <p>The alternative would be:</p>
  
  <pre><code>var something = foo + bar +
      baz(mumble);
  </code></pre>
  
  <p>That's not as good for me. Now the only way to tell that <code>baz(mumble);</code> isn't standalone (indentation aside) is to scan your eyes to the end of the previous line. * (Which is presumably long, as you needed to break it in the first place.)*</p>
  
  <p><strong>But in bizarro JavaScript land</strong>, I started seeing people changing code from things that looked like the first form to the second, and warning about "automatic semicolon insertion". It certainly causes <a href="http://lucumr.pocoo.org/2011/2/6/automatic-semicolon-insertion/" rel="nofollow noreferrer">some surprising behaviors</a>. Not really wanting to delve into that tangent at the time I put <em>"learn what automatic semicolon insertion is and whether I should be doing that too"</em> into my infinite task queue.</p>
  
  <p>When I did look into it, I found myself semi-sure... but not certain... that there aren't dangers with how I use it. It seems the problems would come from if I had left off the <code>+</code> on accident and written:</p>
  
  <pre><code>var something = foo + bar
      baz(mumble);
  </code></pre>
  
  <p>...then JavaScript inserts a semicolon after <code>foo + bar</code> for you, seemingly because both lines stand alone as complete expressions. I deduced perhaps those other JavaScript programmers thought biasing the "clearly intentionally incomplete" bit to the end of the line-to-be-continued was better, because it pinpointed the location <em>where the semicolon wasn't</em>.</p>
  
  <p>Yet if I have stated my premise correctly, I am styling my broken lines in a way that the ensuing lines are "obviously incomplete". If that weren't the case then I wouldn't consider my way an advantage in the first place.</p>
  
  <p><strong>Am I correct, that my way is not a risk for the conditions I describe of how I use line continuations? Are there any "incomplete seeming" expression pitfalls that are actually complete in surprising Ways?</strong></p>
  
  <p>To offer an example of "complete in surprising ways", consider if <code>+ 1;</code> could be interpreted as just positive one on a line by itself. Which it seems it can:</p>
  
  <p><img src="https://i.stack.imgur.com/rLySy.png" alt="plus one semicolon"></p>
  
  <p>But JSFiddle gives back 6 for this:</p>
  
  <pre><code>var x = 3 + 2
  + 1;
  alert(x)
  </code></pre>
  
  <p>Maybe that's just a quirk in the console, but it causes me to worry about my <em>"it's okay so long as the second line doesn't stand alone as complete expression"</em> interpretation.</p>