An issue has arisen where the loop is only displaying the last value of the array, which is 'o'
const h2 = document.querySelector('h2');
const title = document.querySelector('h1');
const word = ['h', 'e', 'l', 'l', 'o'];
function loopThroughWords() {
for(let i = 0; i < word.length; i++) {
window.setInterval(() => {
console.log(word[i]);
title.textContent = word[i];
}, 1000)
}
}
loopThroughWords();
<h1 />
<h2 />