let array1 = Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
how to make like this array with shortest way ? is it possible to make shorter way ?
thank you for your answers.
Asked
Active
Viewed 224 times
-2

ÇAĞRI ÇIBUK
- 61
- 1
- 5
1 Answers
3
You can use the .fill()
method:
let array1 = new Array(16).fill(0);
As its name suggests, it fills the array with some desired value.

Pointy
- 405,095
- 59
- 585
- 614