摘要:
今天看到群里聊到了逗号运算符,就总结一下,我对它的理解吧,勿喷!(ps:苦逼孩子,人家都讨论完半天了,刚才看到!!尼玛!)逗号运算符:是按顺序执行表达式,并且获得右边表达式的值。来个例子:var a = 10;var b = 20;var c = (a++,b++,100);console.log(a);console.log(b);console.log(c);值是11,21,100大彻大悟了么?关于运算符优先级问题可以查看:https://developer.mozilla.org/zh-CN/docs/JavaScript/Reference/Operators/Operator_Pre 阅读全文