The example below displays only the last value. I'd like to view all of them with an interval of 2 seconds.
(2 seconds pass / value1 appears / 2 seconds pass / value 2 appears / etc...)
What am I missing?
const output = getElementById('output'); // <span>-Element to display output
const numbers = new Array( // array of integers
235,
453,
999,
872
);
btn2.addEventListener('click', function(){ // foreach loop etc.
setTimeout(function(){
numbers.forEach(number => output.innerHTML = number);
}, 2000);
});