How can I get the full object in Node.js's console.log(), rather than '[Object]'?

前端 未结 17 2932
一向
一向 2020-11-22 02:59

When debugging using console.log(), how can I get the full object?

const myObject = {
   \"a\":\"a\",
   \"b\":{
      \"c\":\"c\",
      \"d\":         


        
17条回答
  •  攒了一身酷
    2020-11-22 03:17

    perhaps console.dir is all you need.

    http://nodejs.org/api/console.html#console_console_dir_obj

    Uses util.inspect on obj and prints resulting string to stdout.

    use util option if you need more control.

提交回复
热议问题