This is due to the fact that setTimeout is an asynchronous function, hence one would have to continue the execution of the code, in the callback passed to it, after the elapsed time. The only problem is, using setTimeout is not as convenient as one would like. JavaScript does not have a similar sleep function, although it has the setTimeout function which can be used to achieve a similar purpose. Not surprising this functionality is often implemented via a function usually named sleep. Most popular mainstream languages have a sleep functionality that allows for the pausing of code execution for a specified amount of time.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |