diff options
-rw-r--r-- | doc/api/console.md | 4 | ||||
-rw-r--r-- | doc/api/util.md | 11 |
2 files changed, 7 insertions, 8 deletions
diff --git a/doc/api/console.md b/doc/api/console.md index 3411d3ce0a..4939ed77be 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -246,9 +246,7 @@ console.log('count:', count); // Prints: count: 5, to stdout ``` -If formatting elements (e.g. `%d`) are not found in the first string then -[`util.inspect()`][] is called on each argument and the resulting string -values are concatenated. See [`util.format()`][] for more information. +See [`util.format()`][] for more information. ### console.time(label) <!-- YAML diff --git a/doc/api/util.md b/doc/api/util.md index 0669330795..b299a67409 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -177,16 +177,17 @@ util.format('%s:%s', 'foo'); // Returns: 'foo:%s' ``` -If there are more arguments passed to the `util.format()` method than the -number of placeholders, the extra arguments are coerced into strings (for -objects and symbols, `util.inspect()` is used) then concatenated to the -returned string, each delimited by a space. +If there are more arguments passed to the `util.format()` method than the number +of placeholders, the extra arguments are coerced into strings then concatenated +to the returned string, each delimited by a space. Excessive arguments whose +`typeof` is `'object'` or `'symbol'` (except `null`) will be transformed by +`util.inspect()`. ```js util.format('%s:%s', 'foo', 'bar', 'baz'); // 'foo:bar baz' ``` -If the first argument is not a format string then `util.format()` returns +If the first argument is not a string then `util.format()` returns a string that is the concatenation of all arguments separated by spaces. Each argument is converted to a string using `util.inspect()`. |