Home > Web Front-end > JS Tutorial > Instructions for using the console.warn method in node.js_node.js

Instructions for using the console.warn method in node.js_node.js

WBOY
Release: 2016-05-16 16:28:12
Original
1584 people have browsed it

Method description:

This method is the same as console.error(). If you look at the source code, you will know that console.error actually directly calls console.warn

Grammar:

Copy code The code is as follows:

console.warn([data], [...])

Receive parameters:

console.log accepts several parameters. If there is only one parameter, the string form of this parameter will be output.

If there are multiple parameters, it will be output in a format similar to the C language printf() command.

If there are no parameters, just print a newline character

Example:

Copy code The code is as follows:

var count = 1234;
console.error('count: %d', count);

Source code:

Copy code The code is as follows:

Console.prototype.warn = function() {
This._stderr.write(util.format.apply(this, arguments) 'n');
};
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template