8/14/2023 0 Comments Await javascriptYou may have tried it at some point in a JavaScript loop and seen that setTimeout() seems to not work at all. Unfortunately, setTimeout() does not work quite as you might expect, depending on how you use it. “The setTimeout() method of the WindowOrWorkerGlobalScope mixin (and successor to tTimeout()) sets a timer which executes a function or specified piece of code once the timer expires.” - MDN Docs There’s no sleep() method in JavaScript, so you try to use the next best thing, setTimeout(). Let’s say you want to log three messages to Javascript’s console, with a delay of one second between each one. “In computing, sleep is a command in Unix, Unix-like and other operating systems that suspends program execution for a specified time.” - Wikipedia
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |