91-9990449935 0120-4256464 |
Node.js TimerNode.js Timer functions are global functions. You don't need to use require() function in order to use timer functions. Let's see the list of timer functions. Set timer functions:
Clear timer functions:
Node.js Timer setInterval() ExampleThis example will set a time interval of 1000 millisecond and the specified comment will be displayed after every 1000 millisecond until you terminate. File: timer1.js Open Node.js command prompt and run the following code: File: timer5.js Open Node.js command prompt and run the following code: Node.js Timer setTimeout() ExampleFile: timer1.js Open Node.js command prompt and run the following code: This example shows time out after every 1000 millisecond without setting a time interval. This example uses the recursion property of a function. File: timer2.js Open Node.js command prompt and run the following code: Node.js setInterval(), setTimeout() and clearTimeout()Let's see an example to use clearTimeout() function. File: timer3.js Open Node.js command prompt and run the following code: You can see that the above example is recursive in nature. It will terminate after one step if you use ClearInterval. Node.js setInterval(), setTimeout() and clearInterval()Let's see an example to use clearInterval() function. File: timer3.js Open Node.js command prompt and run the following code:
Next TopicNode.js Errors
|