console.log([data][, ...args])


打印到 stdout,并加上换行符。 可以传入多个参数,第一个参数作为主要信息,其他参数作为类似于 printf(3) 中的代替值(参数都会传给 util.format())。

const count = 5;
console.log('计数: %d', count);
// 打印到 stdout: 计数: 5 
console.log('计数:', count);
// 打印到 stdout: 计数: 5 

有关更多信息,请参见 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

See util.format() for more information.