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

Node.js · Theory

REPL

← All stacks

Theory

6/723

REPL

REPL is the Node prompt: type node with no file. You try 2+2 and see 4. .exit to leave. Great for testing a one-liner. Not how you ship an API.

Trap — thinking REPL is the production server.

Exam tip

Type node, try 2+2, .exit.

Example

// REPL
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));

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

Short notes

  • DefREPL = interactive node with no file.
  • Rulenode then .exit.
  • TrapREPL as the app.

Questions

1

How do you open the REPL?

6 / 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.