I read their API, however, there is nothing about Date object, or h开发者_如何学编程ow to generate a simple random number (e.g. Math.random() ). Those internal objects are different from the client side javascript ones. so where can I find out ? Thank.s
Those internal objects are the same as the objects that run in google chrome. They're provided by the v8 engine.
The documentation for the current release of NodeJS (v0.4.6) can be found here: http://nodejs.org/docs/v0.4.6/api/all.html
On the whole, many of the internal objects within NodeJS should be same as your expect to see on the client-side.
Loading up the REPL from my terminal, I see the following:
> Math.random
[Function: random]
> Math.random();
0.8805044267792255
> Math.random();
0.3855400965549052
> new Date();
Mon, 18 Apr 2011 21:58:19 GMT
> new Date();
Mon, 18 Apr 2011 21:58:20 GMT
精彩评论