I'm doing a practice with callback functions what I want is that for every loop that the loop has a waiting time of 2 seconds I have an array with letters what I try to do is print the letters of it every 2 seconds .
I am trying to do with the setTimeout method but I do not get the expected result. You could give me a support with this exercise please.
Greetings.
var array1 = ['a', 'b', 'c'];
function llamadora(array1,callback){
callback(array1);
}
var ejecutora = (function(array1){
array1.forEach(function(element) {
setTimeout(console.log(element),2000);
});
})
llamadora(array1, ejecutora)