I have an arrays=[John; Alex; Mark], I wanna to show the elements of this array one by one by 3 second delay.
s=[John; Alex; Mark]
for (var i=0; i<=3; i++) {
You can use setInterval to show elements one by one after 3 seconds delay:
setInterval
s=["John", "Alex", "Mark"]; var i = 0; var id = setInterval(function(){ if(i > s.length) { clearInterval(id); } else{ console.log(s[i++]); } }, 3000);