0
I want to fill in the tags li
with what you have in the array nomes
.
I know what the attribute is for value
serves, it is far from what I want to do. But I left there to illustrate.
var nomes = ["Diego", "Gabriel", "Lucas"];
var listaUl = document.querySelector('div#app ol.lista');
function listarNomes(nomes) {
for(let i = 0; i <= nomes.length-1; i++){
var item = document.createElement('li');
item.setAttribute('name', nomes[i]); //é aqui que preciso de ajuda
listaUl.appendChild(item);
}
}
Instead of
i <= nomes.length-1
, usei < nomes.length
.– Sam