受自動分號插入影響的語句
- 空的陳述
var
宣告- 表達陳述
do-while
宣告continue
宣告break
宣告return
宣告throw
宣告
例子:
當遇到令牌輸入流的末尾並且解析器無法將輸入令牌流解析為單個完整的程式時,則在輸入流的末尾自動插入分號。
a = b
++c
// is transformed to:
a = b;
++c;
x
++
y
// is transformed to:
x;
++y;
陣列索引/文字
console.log("Hello, World")
[1,2,3].join()
// is transformed to:
console.log("Hello, World")[(1, 2, 3)].join();
退貨宣告:
return
"something";
// is transformed to
return;
"something";