Knowing that while Node.js is working asynchronously, writing something like this:
function sleep() { var stop = new Date().getTime(); while(new Date().g
As already mentioned, asynchronous execution should be achieved by setTimeout() rather than while, because while will freeze in one "execution frame".
Also it seems you have syntax error in your example.
This one works fine: http://jsfiddle.net/6TP76/