You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
消除歧异
歧义只是语句上下文中的问题:如果 JavaScript 解析器遇到歧义语法,它不知道它是普通语句还是表达式语句。 例如:
{
开头:它是对象字面量还是代码块?为了解决歧义,以
function
或{
开头的语句永远不会被解释为表达式。如果希望表达式语句以这些标记之一开头,则必须将其括在括号中。自动插入分号
ASI 的工作原理如下。语句的解析继续进行,直到出现以下任一情况:
换句话说,ASI 可以看作是在换行符处插入分号。
Beta Was this translation helpful? Give feedback.
All reactions