Quantcast
Channel: How to instantiate a javascript array with the same value - Stack Overflow
Viewing all articles
Browse latest Browse all 3

How to instantiate a javascript array with the same value

$
0
0

I want to type something like [1] * totalPoints so that if totalPoints was 3, it would give me an array of [1,1,1]. I can't think of what it would be called though.. as such, my searches have turned up nothing. I mean, I could easily accomplish this with a for loop, but I seem to be under the impression that I've used something like this before and I just can't think of it. Is there anything like this in javascript?


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images