HTML JS

CREATE HTML LIST FROM JAVASCRIPT ARRAY

DUMMY ARRAY var arr = ["Apple", "Banana", "Cherry"];

CREATE ELEMENT

01

CREATE LIST var ol = document.createElement("ol"); for (let i of arr) {   let li = document.createElement("li");   li.innerHTML = i;   ol.appendChild(li); }

APPEND LIST TO CONTAINER document.getElementById("ID"). appendChild(ol);

DUMMY ARRAY var arr = ["Apple", "Banana", "Cherry"];

MANUAL HTML

02

CREATE LIST var ol = "<ol>"; for (let i of arr) { ol += `<li>${i}</li>`; } ol += "</ol>";

APPEND LIST TO CONTAINER document.getElementById("ID"). innerHTML = ol;