I'm trying to make a text display in DOM from a->b->c->d->e with a 1-second delay between each alphabet using setTimeout. However, the result came out as letter changing from 'a' an immediately to 'e' without displaying 'b' 'c' 'd'. However, all the letters are displayed in the console without having 1-second delay. Sorry for my confusing explanation.
function changeLetter() {
const symbols = ['Ai', 'a', 'b', 'c', 'd']
let symbol
for (let i = 0; i < symbols.length; i++) {
setTimeout(() => {
symbol = symbols[i]
console.log(symbol)
document.getElementById("change").innerHTML = symbol;
}, 1000)
}
}
changeLetter()
<h1 id="change"></h1>