Saturday, 24 August 2013

Array of length bracket notation

Array of length bracket notation

If I want to make an array that is say of length 3 using bracket notation,
should I just write: var foo = [,,];
I was more used to writing: var foo = new Array(3);
I noticed that if I removed one , that my code still worked which is
surprising because I am accessing all 3 elements after assigning them. How
is it that it would still work?

No comments:

Post a Comment