December 2023
Intermediate to advanced
242 pages
5h 28m
English
| Recipe 12 | Displaying Tabular Data in Console with console.table() |
Suppose you have been performing additions and subtractions on an array, but you are encountering some problems. You want to inspect the contents of the array at a particular line in your script so you can pinpoint the problem.
You need a way to quickly print the array’s content to the console.
Use the console.table() method:
| | const data = [ |
| | {quarter: "Q1 FY22", revenue: 45962, netIncome: 20820, eps: 2.71}, |
| | {quarter: "Q2 FY22", revenue: 44845, netIncome: 20610, eps: 2.71}, |
| | {quarter: "Q3 FY22", revenue: 46151, netIncome: 16027, eps: 2.03}, |
| | {quarter: "Q4 FY22", revenue: 46822, netIncome: 16244, ... |
Read now
Unlock full access