<h3>Todos:</h3>
<ul id="list1"></ul>
const todos = [
'buy milk',
'clean kitchen',
'learn js',
]
const appendItem = (item) => {
const el = document.createElement('li')
const elText = document.createTextNode(item)
el.appendChild(elText)
document.getElementById('list1').appendChild(el)
}
/*
Here is a simple way to apply the `appendItem` function
to each item in the array:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
*/
todos.forEach(appendItem)
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.