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

后端 未结 7 1311
孤街浪徒
孤街浪徒 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:15

    Why not just use separate console.log() for each var, and separate with a comma rather than converting them all to strings? That would give you separate lines, AND give you the true value of each variable rather than the string representation of each (assuming they may not all be strings).

    console.log('roleName',roleName);
    console.log('role_ID',role_ID);
    console.log('modal_ID',modal_ID);
    console.log('related',related);
    

    And I think it would be easier to read/maintain.

提交回复
热议问题