Difference between console.log and sys.puts in node.js?

后端 未结 7 1746
無奈伤痛
無奈伤痛 2021-01-31 01:38

In node.js you can use console.log or sys.puts to print out to the screen.

What is the preferred method and what is the difference between thes

7条回答
  •  走了就别回头了
    2021-01-31 02:28

    Both just write to the stdout stream. The difference is that sys.puts just toString's the first argument, and console.log takes multiple arguments, and will sys.inspect the first arg if it's not a string.

提交回复
热议问题