console.log 方法:
console.log("This is a test string");
node App.JS
使用重定向标准输出流:
node App.JS 1>info.log
image.PNG
image.PNG
console.log = console.info
console.error 方法
2 代表重定向标准错误输出流
node App.JS 2>error.log
命令运行一个并不存在的 script.JS 文件
node script.JS 2>error.log
console.warn 方法 代替 console.error 方法
console.dir 方法
用于查看一个对象中的内容并且将该对象的信息输出到控制台中
image.PNG
console.time 方法用于标记开始时间与 console.timeEnd 方法用于标记结束时间.
image.PNG
image.PNG
- var user=new Object();
- user.name = "Lu";
- user.getName=function(){
- return this.name;
- };
- user.setName=function(name){
- this.name=name;
- };
- console.trace('trace');
image.PNG
在 node.JS 中定义了一个 global 对象, 代表 Node.JS 中的全局命名空间, 任何全局变量, 函数, 对象都是该对象的一个属性值.
console.log(global);
image.PNG
image.PNG
clearTimeout 函数使用一个参数, 参数值为 setTimeout 函数所返回的定时器对象.
image.PNG
clearInterval 函数使用一个参数, 为 setInterval 函数所返回的定时器对象.
image.PNG
timer.unref();
unref 方法取消 setTimeout 函数或 setInterval 函数中指定的回调函数的调用.
image.PNG
image.PNG
image.PNG
image.PNG
image.PNG
image.PNG
image.PNG
image.PNG
image.PNG
image.PNG
image.PNG
代表缓存了所有已经加载模块缓冲区
image.PNG
image.PNG
image.PNG
image.PNG
image.PNG
image.PNG
image.PNG
image.PNG
image.PNG
image.PNG
来源: http://www.jianshu.com/p/b27eed2416e0