console.log([data][, ...args])
使用换行符打印到 stdout
。可以传递多个参数,第一个用作主要消息,所有附加参数用作类似于 printf(3)
的替换值(参数全部传递给 util.format()
)。
¥Prints to stdout
with newline. Multiple arguments can be passed, with the
first used as the primary message and all additional used as substitution
values similar to printf(3)
(the arguments are all passed to
util.format()
).
const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout
有关详细信息,请参阅 util.format()
。
¥See util.format()
for more information.