Skip to content
Learn Netverks

Lesson

Step 7/36 19% through track

console-process

Console and process I/O

Last reviewed May 28, 2026 Content v20260528
Track mode
nodejs_server
Means
Node sandbox
Reading
~1 min
Level
beginner

This lesson

This lesson teaches Console and process I/O: the syntax, APIs, and habits you need before advancing in Node.js.

Teams ship Console and process I/O on every Node.js codebase—skipping it leaves gaps in debugging and code reviews.

You will apply Console and process I/O in contexts like: REST/GraphQL APIs, BFF layers, CLIs, webhooks, and real-time services (with WebSockets).

Run JavaScript on the Node runner when configured—never mix arbitrary shell commands in lessons.

When you can explain the previous lesson's ideas without copying starter code.

console.log writes to stdout; console.error writes to stderr. In servers, separating logs from errors helps aggregators filter severity. process.stdin and process.stdout are streams for CLI tools.

Console helpers

  • console.log(a, b) — space-separated values
  • console.table(arrayOfObjects) — tabular debug output
  • console.time('label') / console.timeEnd('label') — rough timing
  • console.dir(obj, { depth: null }) — nested object inspection

Exit codes

Uncaught exceptions exit with non-zero code. CLI tools convention: 0 success, 1 general error, other codes for specific failures (document yours in README).

Important interview questions and answers

  1. Q: stdout vs stderr?
    A: stdout for normal output (pipeable); stderr for errors/diagnostics so pipelines can still capture clean data.
  2. Q: console.log in production APIs?
    A: Prefer structured loggers (pino, winston) with levels and JSON—raw console is fine for learning and scripts.

Self-check

  1. Which stream does console.error use?
  2. When is console.table helpful?

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • stdout vs stderr?
  • exit code when?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump