This article mainly introduces node. console in js. this document describes how to use the warn method. warn method description, syntax, receive parameters, use instances and implementation source code. For more information, see
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:
The 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:
The Code is as follows:
Var count = 1234;
Console. error ('count: % d', count );
Source code:
The Code is as follows:
Console. prototype. warn = function (){
This. _ stderr. write (util. format. apply (this, arguments) + '\ n ');
};