Advertisement
728x90
You can create an array with some data or an array with the same values using fill method.
javascript
1var newArray = new Array(5).fill("0");
2
3console.log(newArray); // ["0", "0", "0", "0", "0"]Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 28
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
370of476