Quantcast
Viewing latest article 1
Browse Latest Browse All 3

Answer by dereference for How to instantiate a javascript array with the same value

Create a new array of size 3 then use the array map function on each element, calling valueOf:

var totalPoints = Array.apply(null, new Array(3)).map(Number.prototype.valueOf,1);

http://jsfiddle.net/pXgu4/


Viewing latest article 1
Browse Latest Browse All 3

Trending Articles