Hello guys, this is my final code and I am stuck on it. Could anyone take a peek to check what I am doing wrong? Thanks a lot for your time!
let myArray = [‘tomatoes’, ‘chick peas’, ‘onions’, ‘rice’, ‘black beans’];
let list = document.createElement(‘ul’);
function listArray() {
for (let i = 0; i < myArray.length; i++) {
let element = document.createElement('li');
li.textContent = myArray[i];
list.appendChild(element);
}
}
let section = document.querySelector(‘section’);
section.appendChild(list);