I want to make li elements with properties like below but it doesn't work at all. Could you help me with what is wrong?
var array = [1, 2, 3, "mm", "b", "c", "mm", "y", "mm"];
var list = document.getElementById("list");
function addText(array) {
for (var i = 0; i <= array.length; i++); {
var text = array[i];
if (array[i] == "mm") {
var listItem = document.createElement("LI");
listItem.innerHTML = text;
list.appendChild(listItem);
}
}
};
i <= array.lengthin your loop?console.loginside the loop would have let you figure out what was going on. These are basic debugging techniques.