Hacker News new | ask | show | jobs
by tsimionescu 1432 days ago
I meant that you would usually encounter those as statements, as in the following example:

  function foo() {
    alert("Hello, World!");
    doSomething();
  }
And not as expressions (as in your example of `console.log(alert("Hello, World"))`.

Btw, a better rule of thumb for JS is "if you can add `;` after it and not alter the meaning of the program, it's a statement; otherwise it's an expression".