javascript init an array to 0 1

javascript init an array to 0

new Array(len).fill(0);

Here is what the above code is Doing:
1. We create a new array of length len.
2. We fill the array with 0s.
3. We return the array.

Similar Posts