title: Interesting error based on automatic semicolon insertion JS rules. Explanation required
body: <p>Today I wrote code for some programming contest. When I run it I was surprised because of error. <strong>Cannot read property 'forEach' of undefined</strong> in a place where looks like "error free space".</p>
  
  <pre><code>sum = 0
              [-1,0,1].forEach(deltar =&gt;{...});
  </code></pre>
  
  <p>When I add semicolon after <code>sum</code> variable value assignment code start to works. </p>
  
  <pre><code>sum = 0;
              [-1,0,1].forEach(deltar =&gt;{...});
  </code></pre>
  
  <p>It's very curious about <em>JS</em> behavior what do interpreter mismatch here?  how do <em>JS</em> mess with <em>integer</em> and <em>array</em> after it?</p>
  
  <p>Here it is a full code of the function to make the complete picture of variables declaration.</p>
  
  <pre><code>function boxBlur(img) {
      let [h,w] = [img.length-1,img[0].length-1];
      let [answer,sum,tmp] = [[],0,[]]
      for(let row = 1; row &lt; h; row += 1){
          tmp = []
          for(let clmn = 1; clmn &lt; w; clmn += 1){
              sum = 0;
              [-1,0,1].forEach(deltar =&gt;{
                  [-1,0,1].forEach(deltac =&gt;{
                      sum += img[row+deltar][clmn+deltac]
                  });
              });
              tmp.push(parseInt(sum/9));
          }
          answer.push(tmp);
      }
      return answer;
  }
  </code></pre>