Declaring multiple variables in JavaScript

后端 未结 17 925
时光说笑
时光说笑 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条回答
  •  旧时难觅i
    2020-11-22 13:18

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

    is more readable than:

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

    But they do the same thing.

提交回复
热议问题