We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
除了分号之外,逗号允许你在同一个地方放多个语句。 例如:
for(var i=0, j=0; i<5; i++, j++, j++){ console.log("i:"+i+", j:"+j); }
輸出:
i:0, j:0 i:1, j:2 i:2, j:4 i:3, j:6 i:4, j:8
当放一个表达式时,它由左到右计算每个表达式,并传回最右边的表达式。
例如:
function a(){console.log('a'); return 'a';} function b(){console.log('b'); return 'b';} function c(){console.log('c'); return 'c';} var x = (a(), b(), c()); console.log(x); // 输出「c」
输出:
"a" "b" "c" "c"
,
(x = a()), b(), c();
The text was updated successfully, but these errors were encountered:
No branches or pull requests
📚在线阅读:JavaScript 的逗号操作符 - No.57
除了分号之外,逗号允许你在同一个地方放多个语句。
例如:
輸出:
当放一个表达式时,它由左到右计算每个表达式,并传回最右边的表达式。
例如:
输出:
,
)操作符在 JavaScript 中所有的操作符里是最低的优先顺序,所以没有括号表达式将变为:(x = a()), b(), c();
。实验
扩展阅读:
The text was updated successfully, but these errors were encountered: