What?
Hello guys, I am totally new to this and I did it as a kind of test and there is something I do not understand ... I made this code: var list = document.getElementById ("list") var arrayItems = ["item1", "item2", "item3"] var li = document.createElement ("li") arrayItems.forEach (item => { li.textContent = item console.log (li) list.appendChild (li) }) Then I saw and hoped that the console will launch me 3 times the label "li" with the content of the respective tour, that is, first "item1", "item2" and "item3" but no, it launches the label li 3 times but with the content of "item3" only and I do not understand why, it is as if the loop is omitting the console or something like that Why does this happen ? And well I know that the creation of the li label is outside the loop and maybe this has to do with that xq doing it with the label inside and it happens as expected, but in the end I can't explain why this is with the label outside the loop