Bird
0
0

You want to display an array of user objects as a neat table in the console. Which console method should you use to achieve this?

hard📝 Application Q15 of 15
Node.js - Debugging and Profiling
You want to display an array of user objects as a neat table in the console. Which console method should you use to achieve this?
Aconsole.group(users);
Bconsole.log(users);
Cconsole.dir(users);
Dconsole.table(users);
Step-by-Step Solution
Solution:
  1. Step 1: Understand console.table() purpose

    console.table() displays arrays or objects as formatted tables, making data easier to read.
  2. Step 2: Compare with other methods

    console.group() groups logs, console.dir() shows object details, and console.log() prints raw data without table formatting.
  3. Final Answer:

    console.table(users); -> Option D
  4. Quick Check:

    Display arrays as tables = console.table() [OK]
Quick Trick: Use console.table() to show arrays or objects as tables [OK]
Common Mistakes:
  • Using console.log() which shows raw array
  • Using console.group() which groups logs but no table
  • Confusing console.dir() with table display

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Node.js Quizzes