You can download and install Node.js from http://nodejs.org/
Once, you are done with the installation. You can open the Node.js prompt where you can familiarize with Node. As said, you can type “process” which is the global variable in Node. You will be able to see properties of the process object such as pid, env, config etc. You can drill down into these properties by typing process.pid, process.env, process.config etc.
The result of the execution would appear as “Hi” appearing first and after 3 seconds “Abhishek” appears. Thus, we understand that setTimeout function basically acts in an asynchronous fashion by executing the final statement of logging “Hi” and after 3 seconds executes the log statement inside setTimeout.
In PHP, you could achieve the same result by
Here also, the result would be “Hi” and after 3 seconds “Abhishek”.
Thus, in Node
Therefore in Node, there is no question of stopping anywhere even if you wish to stop. There is no question of waits and locks. The bottom line is that you cannot do anything that halts the execution cycle. You can IDLE the execution cycle but never HALT.
Stay Tuned. Hope this blog helped you to understand the basics of Node.