If you want to initialize an array that you don't need to iterate over -
Array(100) or new Array(100)
If you do need to iterate over it -
Array.from({length: 5}, (v, i) => i)
If you want to initialize an array that you don't need to iterate over -
Array(100) or new Array(100)
If you do need to iterate over it -
Array.from({length: 5}, (v, i) => i)
For further actions, you may consider blocking this person and/or reporting abuse
thinkThroo -
Zakir -
codenextgen -
Md. Maruf Sarker -
Top comments (1)
Just an adder: If you want to initialise it with say, all 0s or some number.. You can also do
new Array(100).fill(0)