js the console and the print string objects in a row

In the front-end development, most of the debugging F12 are generally in the console and network view request data and response data, there are some people like to use the debugger.

In the development of a large number of projects in the development environment, open a console, switch what pages are always filled with a variety of console, but also a lot of lines, in part because there is the following I wrote this.

 

 If the print is because the strings and objects at the same time on the same line, we think of it as stitching prototype object calls toString () method, let us look to bad.

the console.log ( 'upload result' + {obj: 'objects', name: 'Zang three'});

 

View yesterday in the development program of a backstage look at the micro-channel business, saw his console in the same line simultaneously print the string and object, thought the original can be printed on the same line.

 

Sometimes when viewed before thought of calling it JSON.stringtify () method, but this time when the object is complex, not conducive to viewing and debugging.

the console.log ( 'upload result' + JSON.stringify ({obj: 'objects', name: 'John Doe'}));

 

 I feel a bit long-winded writing, and obviously that is a comma revisit things, you give me so much useless pull ha ha.

Look at the effect, if this is printed, then I will feel a lot clearer, and the number of rows console will be less.

 

 Specific approach is to console between the various parameters of a comma,

the console.log ( 'upload result', {obj: 'objects', name: 'John Doe'});

If it helps you, I will be very happy.

 

Guess you like

Origin www.cnblogs.com/z937741304/p/11495909.html