in javascript how would I create an empty array of a given size
Psuedo code:
X = 3;
createarray(myarray, X, \"\");
output:
You can use both javascript methods repeat() and split() together.
" ".repeat(10).split(" ")
This code will create an array that has 10 item and each item is empty string.
const items = " ".repeat(10).split(" ")
document.getElementById("context").innerHTML = items.map((item, index) => index)
console.log("items: ", items)