Cara menambahkan li secara dinamis dalam javascript

// List items array
const items = ["item1", "item2", "item3"];
// Get a reference to unordered list element
const ulEl = document.getElementById("ul-el");
// Create a variable called listItems holding all HTML for list items
let listItems = "";
for(let i=0; i < items.length; i++) {
    // Add each item to listItems variable
	listItems += "<li>" + items[i] + "</li>"; 
}
// Render the listItems inside the ul using ulEl.innerHTML
ulEl.innerHTML = listItems;
Wissam