in javascript how would I create an empty array of a given size
Psuedo code:
X = 3; createarray(myarray, X, "");
output:
myarray = ["","",""]
Advertisement
Answer
var arr = new Array(5); console.log(arr.length) // 5
in javascript how would I create an empty array of a given size
Psuedo code:
X = 3; createarray(myarray, X, "");
output:
myarray = ["","",""]
var arr = new Array(5); console.log(arr.length) // 5