I am trying to use the following prototype to fill
an empty array with integers from 1-100. As per MDN's documentation:
array.prototype.fill(value, [optional start & end index])
If my understanding is correct if I call my value = 1
then if I say:
[5].fill(1);
I would be left with an array with 1 sitting at all 5 index points of the array. Is there a way using .fill()
to say value = 1...100
? I'm beginning to think running a for loop to push
values 1 - 100 might be the only way to do this, but I thought I would see if this method worked the same.