The console. warn method in node. js is used in node. js scenarios.
Method description:
This method is the same as console. error. You can see the source code. The console. error is actually directly called by console. warn.
Syntax:
Copy codeThe Code is as follows:
Console. warn ([data], [...])
Receiving parameters:
Console. log accepts several parameters. If there is only one parameter, the string format of this parameter is output.
If multiple parameters exist, they are output in a format similar to the C language printf () command.
If no parameter exists, only one line break is printed.
Example:
Copy codeThe Code is as follows:
Var count = 1234;
Console. error ('count: % d', count );
Source code:
Copy codeThe Code is as follows:
Console. prototype. warn = function (){
This. _ stderr. write (util. format. apply (this, arguments) + '\ n ');
};