为什么分号“出乎意料”?

BAS*_*ASS 0 javascript

图片

上面的小提琴中,它表示该行末尾的分号是意外的。为何如此?

alert('foo')?

alert('bar');
Run Code Online (Sandbox Code Playgroud)

Cer*_*nce 5

您在那里拥有的字符不是分号(字符代码 59),而是“希腊问号”,字符代码 894。

console.log('?'.charCodeAt()); // Greek
console.log(';'.charCodeAt()); // Normal
Run Code Online (Sandbox Code Playgroud)

请改用常规;分号。