When tracing out variables in the console, How to create a new line?

后端 未结 7 1448
孤街浪徒
孤街浪徒 2021-01-30 03:39

So I\'m trying to do something simple, I want to break up my traces in the console into several lines, using 1 console.log statement:

console.log(\'roleName = \'         


        
7条回答
  •  天涯浪人
    2021-01-30 04:04

    The worst thing of using just

    console.log({'some stuff': 2} + '\n' + 'something')
    

    is that all stuff are converted to the string and if you need object to show you may see next:

    [object Object]
    

    Thus my variant is the next code:

    console.log({'some stuff': 2},'\n' + 'something');
    

提交回复
热议问题