What is console.table() useful for?
Short answer
console.table() renders an array of objects as a formatted table in the console, making it much easier to scan rows and columns than reading nested console.log() output.
Advertisement
AModel answer
console.table() renders an array of objects as a formatted table in the console, making it much easier to scan rows and columns than reading nested console.log() output.
console.table([
{ name: 'Sam', age: 30 },
{ name: 'Alex', age: 25 }
]);Real-world example
Quickly inspecting an array of API results without writing custom formatting code.
Likely follow-ups
- What other lesser-known console methods exist, like console.group()?
Related topics