Home >Web Front-end >JS Tutorial >Summary of console usage in node.js_node.js
/*
module.js:340
throw err;
^
Error: Cannot find module 'E:nodegysjavascript.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
*/
//Eight: The usage of console.warn is the same as the usage of console.error()
//Nine: console.time() and console.timeEnd() output the execution time of the intermediate code (note: the parameters of time and timeEnd must be exactly the same)
console.time("for loop time:")
var a=0;
for(var i=0;i<10000000000000;i ){
a ;
}
console.timeEnd("for loop time:")
/*
* 10. The console.trace() method outputs the stack information at the current location as standard error information.
* */
var obj={
Name:"guoyansi",
Age:23,
Eat:function(){}
}
console.trace(obj);
//Output result:
I don’t know if you can understand it, but I can’t understand it anyway.
1 //Ten: console.assert() evaluates the expression result. If the execution result of the expression is false, output a message string and throw an AssertionError exception
2 console.assert("g"==="s","g is not equal to s");
Isn’t it very simple? . Anyway, I feel like I can’t understand it, haha