Counter 1 to 10 by 1 second
for(var i=1;i<11;i++){ (function(i){ setTimeout(function(){ console.log(i); }, 1000*i); })(i); }