Comma operator returns first value instead of second in argument list?

前端 未结 3 999
余生分开走
余生分开走 2020-12-14 12:31

MDN claims that:

The comma operator evaluates both of its operands (from left to right) and returns the value of the second operand

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-14 13:09

    Comma(,) is also a parameter separator.

    Use alert((1,2)) instead.

提交回复
热议问题