Statements affected by automatic semicolon insertion

suggest change

Examples:

When the end of the input stream of tokens is encountered and the parser is unable to parse the input token stream as a single complete Program, then a semicolon is automatically inserted at the end of the input stream.

a = b
++c
// is transformed to:
a = b;
++c;
x
++
y
// is transformed to:
x;
++y;

Array indexing/literals

console.log("Hello, World")
[1,2,3].join()
// No semicolon is inserted. The `[` continues the call.
// Inside the brackets this is the comma expression (1, 2, 3), whose value is 3.
// console.log returns undefined, so the next read throws.

Return statement:

return 
  "something";
// is transformed to
return;
  "something";

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents