Javascript How to define multiple variables on a single line?

后端 未结 7 2010
渐次进展
渐次进展 2020-11-28 22:20

Reading documentation online, I\'m getting confused how to properly define multiple JavaScript variables on a single line.

If I want to condense the following code,

相关标签:
7条回答
  • 2020-11-28 23:04

    note you can only do this with Numbers and Strings

    you could do...

    var a, b, c; a = b = c = 0; //but why?
    
    c++;
    // c = 1, b = 0, a = 0;
    
    0 讨论(0)
提交回复
热议问题