for (j=1;j<=5;j ++) { (function(i){ setTimeout(function(){console.log(i)}, j*500) })(j) } This particular code is specifically interested in why the delay does not increase by 500 ms? I would be grateful if someone described the principle of the function.