|
@ -9,30 +9,9 @@ Prints to stdout with newline. This function can take multiple arguments in a |
|
|
|
|
|
|
|
|
console.log('count: %d', count); |
|
|
console.log('count: %d', count); |
|
|
|
|
|
|
|
|
The first argument is a string that contains zero or more *placeholders*. |
|
|
If formating elements are not found in the first string then `util.inspect` |
|
|
Each placeholder is replaced with the converted value from its corresponding |
|
|
is used on each argument. |
|
|
argument. Supported placeholders are: |
|
|
See [util.format()](util.html#util.format) for more infomation. |
|
|
|
|
|
|
|
|
* `%s` - String. |
|
|
|
|
|
* `%d` - Number (both integer and float). |
|
|
|
|
|
* `%j` - JSON. |
|
|
|
|
|
|
|
|
|
|
|
If the placeholder does not have a corresponding argument, `undefined` is used. |
|
|
|
|
|
|
|
|
|
|
|
console.log('%s:%s', 'foo'); // 'foo:undefined' |
|
|
|
|
|
|
|
|
|
|
|
If there are more arguments than placeholders, the extra arguments are |
|
|
|
|
|
converted to strings with `util.inspect()` and these strings are concatenated, |
|
|
|
|
|
delimited by a space. |
|
|
|
|
|
|
|
|
|
|
|
console.log('%s:%s', 'foo', 'bar', 'baz'); // 'foo:bar baz' |
|
|
|
|
|
|
|
|
|
|
|
If the first argument is not a format string then `console.log()` prints |
|
|
|
|
|
a string that is the concatenation of all its arguments separated by spaces. |
|
|
|
|
|
Each argument is converted to a string with `util.inspect()`. |
|
|
|
|
|
|
|
|
|
|
|
console.log(1, 2, 3); // '1 2 3' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### console.info() |
|
|
### console.info() |
|
|
|
|
|
|
|
|