I’m messing around with something that would generate some html from an array.
I want to pull the 1st time and plug that into a h1 and the 2nd through nth items of each array to make an unordered list on a page.
I’m very weak in the for loop thing but I think I have the loop working, I just don’t seem to get all the results of the loop just the first result.
Only the initial result of the loop is added to the page. Property21. I would like to end up with Property21, Property22, Property23 added to the page and ideally a
after each.
<script>
var list = [
["Property00", "Property01", "Property02", "Property03"],
["Property10", "Property11", "Property12", "Property13", "Property14", "Property15"],
["Property20", "Property21", "Property22", "Property23"],
["Property30", "Property31", "Property32"]
];
function init() {
var arr = [];
var myOptions = function() {
for (var i = 2; i < 3; i++) {
for (var j = 1; j < list[i].length; j++) {
console.log(list[i][j]);
return list[i][j];
}
}
}
document.getElementById("title").innerHTML = list[0][0];
document.getElementById("options").innerHTML = myOptions();
}
</script>```