SyntaxFix
Write A Post
Hire A Developer
Questions
Try using while loop, Array.prototype.push()
while
Array.prototype.push()
var myArray = [], X = 3; while (myArray.length < X) { myArray.push("") }
Alternatively, using Array.prototype.fill()
Array.prototype.fill()
var myArray = Array(3).fill("");