title: What is an intermediate value?
body: <p>Today I bumped exactly into this issue: <a href="https://stackoverflow.com/questions/42036349/uncaught-typeerror-intermediate-value-is-not-a-function">Uncaught TypeError: (intermediate value)(...) is not a function</a></p>
  
  <p>So yeah, after placing the semicolon where appropriate, it no longer throws that error. However, I never knew there is such a concept in JavaScript <code>(intermediate value)</code>.</p>
  
  <p>Apparently you can generate a similar variation of that error with this piece of code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>[myFunc] = function(someVar){
   
   console.log(someVar);
   return 7;
  }();
  
  //error thrown: (intermediate value) is not a function or its return value is not iterable</code></pre>
  </div>
  </div>
  </p>
  
  <p>And if you name the function, it's no longer <code>intermediate</code>:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function hi(){return undefined}
  
  [a] = hi(); 
  
  // error thrown: hi is not a function or its return value is not iterable</code></pre>
  </div>
  </div>
  </p>
  
  <p>I understand that it refers to something  that is intermediate, but in this case we have an anonymous function, and <a href="https://stackoverflow.com/questions/1920918/find-out-if-function-is-anonymous-or-is-defined-in-a-object">there are ways to determine if a function is anonymous</a>, so the error message could've been a little more explicit.</p>
  
  <p>Searching <a href="https://developer.mozilla.org/en-US/search?page=4&amp;q=%22intermediate+&amp;topic=js" rel="noreferrer">the js mozilla mdn</a> I found <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from" rel="noreferrer">this page</a> that talks about <code>Array.from</code>, where the concept of "intermediate array" can be found:</p>
  
  <blockquote>
    <p>More clearly, <code>Array.from(obj, mapFn, thisArg)</code> has the same result as <code>Array.from(obj).map(mapFn, thisArg)</code>, except that it does not create an <em>intermediate array</em>.</p>
  </blockquote>
  
  <p>But besides pieces of info here and there, it's <strong>not clear what an intermediate value is</strong>. </p>
  
  <p>Is there an official definition to this?</p>