var a = 'word'; function writeWord(a){ var i = 0; function d(i){ alert(a[i]); i++; if (i<a.length) setTimeout(function(){d(i)},1000); } d(i); } writeWord(a);