0
0
Node.jsframework~5 mins

Console methods beyond log in Node.js - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does console.error() do in Node.js?

console.error() prints error messages to the standard error stream. It is useful for showing problems separately from regular output.

Click to reveal answer
beginner
How does console.warn() differ from console.log()?

console.warn() outputs a warning message, often styled differently in consoles to catch attention, while console.log() outputs general information.

Click to reveal answer
beginner
What is the purpose of console.table()?

console.table() displays data as a table in the console, making arrays or objects easier to read and compare visually.

Click to reveal answer
intermediate
Explain console.group() and console.groupEnd().

console.group() starts a new indented group in the console output to organize messages. console.groupEnd() closes the current group.

Click to reveal answer
intermediate
What do console.time() and console.timeEnd() do?

They measure the time between the two calls with the same label, helping to check how long a piece of code takes to run.

Click to reveal answer
Which console method would you use to display a warning message?
Aconsole.debug()
Bconsole.error()
Cconsole.warn()
Dconsole.info()
What does console.table() do?
APrints data as plain text
BPrints data as a list
CPrints data as JSON
DPrints data as a table
How do you measure execution time of code using console methods?
Aconsole.time() and console.timeEnd()
Bconsole.log() and console.error()
Cconsole.group() and console.groupEnd()
Dconsole.count() and console.countReset()
Which method groups console messages together?
Aconsole.group()
Bconsole.table()
Cconsole.clear()
Dconsole.trace()
What is the main difference between console.error() and console.log()?
A<code>console.error()</code> formats messages as tables, <code>console.log()</code> does not
B<code>console.error()</code> outputs to error stream, <code>console.log()</code> to standard output
C<code>console.error()</code> clears the console, <code>console.log()</code> prints messages
DThere is no difference
Describe three console methods beyond console.log() and explain when to use each.
Think about different types of messages you want to show in the console.
You got /3 concepts.
    How can you organize console output to make it easier to read using console methods?
    Imagine grouping related notes in a notebook.
    You got /3 concepts.