js fill array with count elements 1

js fill array with count elements

Array(3).fill(4);                // [4, 4, 4]

Here is what the above code is Doing:
1. We create an array with 3 elements.
2. We fill the array with the value 4.
3. We return the array.

Similar Posts