0
Can variables be declared on a single line e.g, var a, b, c, d, rather than var a, var b, var c, var d, on four separate line?
declaring variables
5 Antworten
+ 4
yes
+ 2
You can, but with coma as separator, you must put the keyword 'var' once....
You can do ( wich is equivalent )
var a; var b; var c;
/* or */ var a, b, c;;
... and with affectation:
var a; var b=42; var c;
/* or */ var a, b=42, c;; // a and c are juste declared, not initialized
+ 1
wow, thank you for a very quick reply.
0
This is good to know!!
- 1
you can make it like this
var a,
b,
c,
d;