逗号运算符,它将先计算左边的参数,再计算右边的参数值。然后返回最右边参数的值。但是它的优先级别最低。
举个例子:
<script>
var a = 10, b = 20;
function CommaTest(){
return a++, b++, 10;
}
var c = CommaTest();
alert(a); // 返回11
alert(b); // 返回21
alert(c); // 返回10
|