PGoCareerGoCareer prep tools
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

Node.js · Theory

Console

← All stacks

Theory

5/723

Console

console.log prints. console.error for errors (stderr). console.table for a small array of objects. In production, a logger (pino/winston) is better than log in a hot loop.

Trap — console.log(hugeObject) in a request handler thousands of times.

Exam tip

console.log('marks', marks);

Example

// Console
const users = [
  { id: 1, name: "Asha" },
  { id: 2, name: "Ravi" },
];

function findUser(id) {
  return users.find((u) => u.id === id) ?? null;
}

console.log(findUser(2));
console.log(users.map((u) => u.name));

Console: find user 2, then list names. Say both prints.

Short notes

  • Defconsole.log / error / table.
  • RuleLogs for debug. Logger in production.
  • TrapLogging in a hot loop.

Questions

1

console.error vs log?

5 / 723

P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.