title: JavaScript: difference between a statement and an expression?
body: <p>I asked <a href="https://stackoverflow.com/questions/12664230/is-boolean-expression-statement-the-same-as-ifboolean-expression-stat/">this</a> question earlier, and after thinking about the topic some more, I began to wonder where the seemingly fuzzy boundary between the meanings of the terms &quot;statement&quot; and &quot;expression&quot; lies. Are all statements also expressions?  Where do the return values in a REPL console come from? They don't always seem to make any intuitive sense.  Of course, if you type <code>1+1</code>, you'll get <code>2</code>, but other times it isn't as obvious what the logic is.</p>
  <p>Given that anything typed into REPL produces <em>some</em> value, does it mean that it can be used in JS source code as both an expression and a standalone statement?</p>
  <p>Can the string of code that could be used for <code>_X_</code> in the following snippet also be used for <code>_Y_</code> and vice versa? <code>if(_X_) _Y_</code>?</p>