Is setting multiple variables in 1 line valid in javascript? (var x=y='value';)

后端 未结 5 1443
春和景丽
春和景丽 2020-12-13 09:17

This is valid in php:

$x=$y=\'value\';

This will in esscence set both $x and $y to \'value\'.

Is this valid in javascript?

5条回答
  •  孤城傲影
    2020-12-13 10:18

    When vars have different values you can easily write:

    var x = 0,
        y = 1,
        ...
        z = 2;
    

提交回复
热议问题