What purpose does name have in the following statement?
var myArray =[], name;
I usually initialize my arrays as the following:
var myArray =[];
It is shorthand to
var myArray =[];
var name;
It is matter of personal preference.
You are actually initialising two variables there, myArray
and name
.
You set myArray
to []
and name
to undefined
, because you don't give any value.
Your code is equivalent to this:
var myArray = [];
var name;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With