Here is a little trick to share with you. Use javascript closure to count by seconds. The code is as follows:
var i =1; for(i; i<10; i++){ (function(num){ setTimeout(function(){ console.log(num); }, num*1000); })(i); }
The focus is on the scope of closures.
The above is the entire content of this article, I hope you all like it.