Declaring multiple variables in JavaScript

后端 未结 17 1023
时光说笑
时光说笑 2020-11-22 13:16

In JavaScript, it is possible to declare multiple variables like this:

var variable1 = "Hello, World!";
var variable2 = "Testing...";
var          


        
17条回答
  •  无人共我
    2020-11-22 13:39

    It's much more readable when doing it this way:

    var hey = 23;
    var hi = 3;
    var howdy 4;
    

    But takes less space and lines of code this way:

    var hey=23,hi=3,howdy=4;
    

    It can be ideal for saving space, but let JavaScript compressors handle it for you.

提交回复
热议问题