SetTimeout(greeting, 3000,"Hello world","John Doe") This is convenient when the function doesn't contain many lines of code.Īnonymous function means that you embed the code directly as the first parameter in setTimeout(), and don't reference the function name like you saw above. Overall, this means that setTimeout() will execute the code contained in a given function once, and only after a specified amount of time.Īt this point, it is worth mentioning that instead of passing a function name, you can pass an anonymous function to setTimeout(). It represents the specified amount of time the program has to wait for the function to be executed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |