Go straight to the dry stuff! 💨

Console. table Displays data

Displaying arrays or objects on the console is more straightforward using console.table than console.log.

// Run on the console
console.table([
  { firstName: 'John'.lastName: 'Doe'.age: 2 },
  { firstName: 'William'.lastName: 'Shakespeare'.age: 3}])Copy the code

Display as a table, much friendlier:

Of course, you can also specify which columns to display

// Run on the console
console.table([
  { firstName: 'John'.lastName: 'Doe'.age: 2 },
  { firstName: 'William'.lastName: 'Shakespeare'.age: 3}], ['firstName'.'lastName'])
Copy the code

The display firstName and lastName columns are specified above, and of course (index) is the default.

Note âš  : syntax console.table(data [, columns]);

Copy Copies data.

If you use Google Chrome and need to copy the data output from the console. You can use the copy() command line instead of manually highlighting and selecting the corresponding code to copy.

const data = [2.3.4];
copy(data);
Copy the code

Executing the code above copies the data data value to your stickboard. You can paste it in any document.

Note that the âš  : copy command only works on the Google Browser console and does not work in the Node.js environment.

reference

  • Developer.mozilla.org/zh-CN/docs/…

  • Dev. The to/tawn33y / 2 – q…