I'm a newbie on JavaScript. I can't understand why if I write
document.getElementById('btn').addEventListener('click', function(){
for (i=0; i<=10; i++){
let writeNumber = document.getElementById('paragraph');
writeNumber.innerHTML = i;
}
})
I read only the last number, in this case '10', and if i write
document.getElementById('btn').addEventListener('click', function(){
for (i=0; i<=10; i++){
document.writeln(i);
}
})
I can read all the numbers required. Thanks and sorry if this seems like a trivial question