JavaScript and Node.js Interview Questions for Freshers (2026): Fundamentals, Code and Answers

JavaScript and Node.js fundamentals plus 30 interview questions for freshers, with tested code outputs, event loop order, closures and Node.js 26 updates....
JavaScript and Node.js Interview Guide

Table of Contents

Phase-Wise Breakdown

Ready to Land a High-Paying Tech Job?

Join Codegnan’s Live Masterclass & build real-world coding projects.

JavaScript and Node.js Interview Questions for Freshers (2026): Fundamentals, Code and Answers

Short answer: JavaScript interviews for freshers usually test six areas repeatedly: data types and equality, scope and hoisting, closures, this, promises and async/await, and the event loop. Node.js interviews add modules, event-loop phases, streams, Express, REST APIs, security and error handling.

If you are preparing for a JavaScript, React, MERN Stack or Node.js developer interview in 2026, knowing syntax alone is not enough. Interviewers increasingly want to know whether you understand why the code behaves the way it does.

That is why questions such as these are common:

  • What does typeof null return?
  • Why does var behave differently from let inside a loop?
  • What is a closure?
  • What is the output of a promise and setTimeout combination?
  • How does this work in arrow functions?
  • What is the difference between Promise.all() and Promise.allSettled()?
  • Is Node.js really single-threaded?
  • What happens inside the Node.js event loop?
  • What are streams and why are they useful?
  • How do you handle errors in Express?

For freshers, these questions are valuable because they reveal whether you understand JavaScript’s execution model rather than simply memorising definitions.

This guide covers 30 frequently asked JavaScript and Node.js interview questions, including output-based questions, conceptual questions, practical examples, Node.js fundamentals and preparation strategies.

What’s New in 2026?

Node.js 26 was released on May 5, 2026. It introduced the Temporal API enabled by default, upgraded V8 to 14.6 and included several deprecations and removals. As of September 30, 2026, Node.js 26 is still the Current release and is scheduled to enter LTS in October 2026. Node.js 24 is currently an LTS release.

This matters in interviews because an interviewer may ask whether you follow the current Node.js ecosystem.

There is another significant change coming. Starting with Node.js 27, the project is moving from two major releases per year to one major release per year. Node.js 27 is scheduled to become Current in April 2027 and LTS in October 2027. Under the new model, every major release will eventually become LTS.

A fresher does not need to memorise every release note. However, being able to explain what Current and LTS mean demonstrates that you understand how Node.js is used in real development environments.

JavaScript Fundamentals in One Table

Concept What to know
Data types 7 primitives: string, number, bigint, boolean, undefined, symbol and null, plus objects
var, let, const var is function-scoped; let and const are block-scoped
== vs === == permits type coercion; === compares without implicit type conversion
Functions Declarations, expressions, arrow functions and higher-order functions
Scope Global, function and block scope
Closures Functions retain access to variables from their lexical environment
Objects and arrays Destructuring, spread, rest, map, filter, reduce and common object methods
this Determined by how a function is called, except arrow functions, which use lexical this
Async JavaScript Callbacks, promises, async/await and the event loop
Modules ES modules using import/export and CommonJS using require/module.exports
Error handling try/catch, promise rejection handling and custom errors
DOM events Event bubbling, capturing and event delegation
Modern JavaScript Optional chaining, nullish coalescing, destructuring, spread/rest and modern array methods

Before jumping into the questions, remember one important interview rule: do not answer only with a definition when the interviewer asks a conceptual question.

For example, if asked what a closure is, saying “a function that remembers its variables” is a starting point. A stronger answer explains that the function retains access to variables from its lexical environment even after the outer function has completed execution.

That extra explanation shows understanding.

JavaScript Interview Questions (1–18)

1. What does typeof null return?

The answer is:

console.log(typeof null);
console.log(typeof undefined);
console.log(typeof NaN);
console.log(typeof []);

Output:
object
undefined
number
object

The surprising result is:

typeof null

which returns:

"object"

This is a historical quirk of JavaScript.

It does not mean that null is actually an object in the conceptual JavaScript type system. null represents the intentional absence of a value and is one of JavaScript’s primitive values.

Similarly:

typeof NaN

returns:

"number"

because NaN is a special numeric value representing an invalid or unrepresentable numerical result.

For example:

console.log(0 / 0);

returns:

NaN

A common follow-up question is:

How do you check whether a value is NaN?

Use:

Number.isNaN(value)

rather than relying on:

value === NaN

because NaN is not equal to itself.

2. What is the difference between == and ===?

The main difference is type coercion.

console.log(0 == '0');
console.log(0 === '0');
console.log(null == undefined);
console.log(null === undefined);
console.log(NaN === NaN);

Output:

true
false
true
false
false

The == operator allows type conversion before comparison.

The === operator compares both type and value without performing the same implicit type conversion.

For example:

5 == '5'

is:

true

because the string can be converted to a number for the comparison.

But:

5 === '5'

is:

false

because one value is a number and the other is a string.

As a general coding practice, === and !== are preferred because they make comparisons more predictable.

An interviewer may ask:

Is == always bad?

A good answer is no. JavaScript’s loose equality has defined rules and can be useful in specific cases, but developers commonly prefer strict equality because it reduces unexpected coercion.

3. What is hoisting?

Hoisting describes how JavaScript processes declarations before executing the code in a scope.

Consider:

console.log(a);

var a = 5;

Output:

undefined

It behaves conceptually like:

var a;

console.log(a);

a = 5;

The declaration is processed before execution, while the assignment remains where it appears.

With let and const, the situation is different.

console.log(a);

let a = 5;

This produces a ReferenceError.

The reason is the Temporal Dead Zone, commonly called the TDZ.

let and const declarations are created during scope setup, but they cannot be accessed before their declaration is evaluated.

A useful interview comparison is:

Declaration Scope Hoisted Accessible before declaration
var Function Yes Yes, as undefined
let Block Yes No, TDZ
const Block Yes No, TDZ
Function declaration Function/block depending on context Yes Generally yes

A common mistake is saying:

“let and const are not hoisted.”

A more accurate answer is that they are hoisted in the sense that their bindings are created during environment setup, but they remain inaccessible during the TDZ until execution reaches their declaration.

4. What is a closure?

A closure occurs when a function retains access to variables from its surrounding lexical environment even after that surrounding function has finished executing.

Example:

function counter() {
  let c = 0;

  return () => ++c;
}

const inc = counter();

console.log(inc());
console.log(inc());

Output:

1
2

The counter() function has already returned, but the returned arrow function still has access to c.

That retained access is the important part of a closure.

Closures are used extensively in JavaScript.

Common examples include:

  • Data privacy
  • Function factories
  • Callbacks
  • Event handlers
  • Timers
  • Memoization
  • React hooks and component logic
  • Maintaining state between function calls

A simple interview explanation is:

A closure is a function together with access to the lexical environment in which the function was created.

If the interviewer asks for a practical example, mention a counter, private variable or function factory.

5. Why does this print 3 3 3 with var but 0 1 2 with let?

Consider:

for (var i = 0; i < 3; i++) {
  setTimeout(() => console.log(i), 0);
}

The output is:

3
3
3

Now consider:

for (let j = 0; j < 3; j++) {
  setTimeout(() => console.log(j), 0);
}

The output is:

0
1
2

Why?

var is function-scoped.

There is effectively one shared binding for i. By the time the timer callbacks execute, the loop has completed and i has become 3.

let is block-scoped and creates a separate binding for each loop iteration.

The callbacks therefore capture different values.

This question tests several concepts simultaneously:

  • Scope
  • Closures
  • Timers
  • Asynchronous execution
  • Event-loop behaviour

That makes it a very popular interview question.

A strong candidate should explain why the values differ rather than simply memorising the outputs.

6. Explain the event loop order.

Consider:

console.log('start');

setTimeout(() => console.log('timeout'), 0);

Promise.resolve().then(() => console.log('promise'));

process.nextTick(() => console.log('nextTick'));

console.log('end');

In Node.js, the output is:

start
end
nextTick
promise
timeout

The first two lines are straightforward.

Synchronous JavaScript runs immediately:

start
end

The timer does not execute immediately just because its delay is 0.

The promise callback is scheduled as a microtask.

Node.js also has process.nextTick(), which has its own queue and is processed with priority relative to the promise microtask queue.

The timer callback is then handled later by the event-loop machinery.

The simplified mental model is:

  1. Run synchronous JavaScript.
  2. Process process.nextTick() callbacks.
  3. Process promise microtasks.
  4. Continue through the relevant event-loop phases.
  5. Execute timer and other asynchronous callbacks when their phase is reached.

The exact internal scheduling rules are more detailed than this simplified model, but this is a useful level for a fresher interview.

7. Shallow copy vs deep copy?

A shallow copy creates a new outer object while nested objects can still be shared.

Example:

const original = {
  name: "John",
  address: {
    city: "Hyderabad"
  }
};

const copy = { ...original };

copy.address.city = "Vijayawada";

console.log(original.address.city);

The nested value changes because the nested address object is still referenced by both objects.

The spread operator:

{ ...original }

therefore creates a shallow copy.

For a deep clone, modern JavaScript provides:

const copy = structuredClone(original);

This creates a deep copy for supported structured-cloneable values.

Another traditional approach is:

JSON.parse(JSON.stringify(original))

but this has limitations. It can lose or transform certain values and does not preserve every JavaScript data type.

A fresher should therefore avoid saying that JSON serialization is a universal deep-copy solution.

8. What are map, filter and reduce?

These are among the most commonly used array methods in modern JavaScript.

map()

map() transforms every element.

const result = [1, 2, 3].map(x => x * 2);

console.log(result);

Output:

[2, 4, 6]

filter()

filter() keeps elements that satisfy a condition.

const result = [1, 2, 3, 4].filter(x => x % 2 === 0);

console.log(result);

Output:

[2, 4]

reduce()

reduce() combines values into a single result.

const result = [1, 2, 3, 4]
  .reduce((sum, x) => sum + x, 0);

console.log(result);

Output:

10

A useful way to remember them:

Method Main purpose
map() Transform
filter() Select
reduce() Accumulate

A common interview follow-up is:

Does map() modify the original array?

No. It creates and returns a new array.

9. What is this in an arrow function?

Arrow functions do not have their own this.

Instead, they use the this value from their surrounding lexical environment.

For example:

const user = {
  name: "Snig",

  regularFunction: function () {
    console.log(this.name);
  },

  arrowFunction: () => {
    console.log(this.name);
  }
};

The regular function’s this is determined by how it is called.

The arrow function does not create its own this.

This is one reason arrow functions are useful for callbacks.

For example:

class User {
  constructor() {
    this.name = "John";

    setTimeout(() => {
      console.log(this.name);
    }, 1000);
  }
}

The arrow function retains the surrounding this.

A common mistake is saying:

“Arrow functions always have the same this.”

The better explanation is:

Arrow functions do not have their own this; they lexically capture this from their surrounding context.

10. What are call, apply and bind?

call(), apply() and bind() allow you to control the this value of a function.

Consider:

function greet(city) {
  console.log(this.name + " from " + city);
}

const user = {
  name: "John"
};

Using call():

greet.call(user, "Hyderabad");

Using apply():

greet.apply(user, ["Hyderabad"]);

Using bind():

const newFunction = greet.bind(user);

newFunction("Hyderabad");

The difference is:

Method Executes immediately? Arguments
call() Yes Individual arguments
apply() Yes Array-like argument list
bind() No Returns a new function

This question is particularly common when interviews test your understanding of function context.

11. What is a Promise?

A Promise represents the eventual result of an asynchronous operation.

A Promise can be in one of three states:

  1. Pending
  2. Fulfilled
  3. Rejected

Example:

const promise = new Promise((resolve, reject) => {
  const success = true;

  if (success) {
    resolve("Operation completed");
  } else {
    reject("Operation failed");
  }
});

You can consume the promise using:

promise
  .then(result => console.log(result))
  .catch(error => console.log(error));

Promises are useful because they provide a structured way to handle asynchronous operations.

Before promises, JavaScript applications commonly relied heavily on nested callbacks, which could become difficult to maintain.

Promises provide a more composable model.

A common interview follow-up is:

Can a Promise change state more than once?

No. Once a Promise becomes fulfilled or rejected, it is settled and cannot transition to another state.

12. async/await vs .then()?

Both are mechanisms for working with promises.

Using .then():

fetchData()
  .then(data => {
    console.log(data);
  })
  .catch(error => {
    console.error(error);
  });

Using async/await:

async function getData() {
  try {
    const data = await fetchData();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

async/await often makes asynchronous code easier to read because it resembles synchronous control flow.

However, await does not make the underlying operation synchronous. It pauses execution of that particular async function while allowing the runtime to continue processing other work.

A common mistake is saying:

“async/await makes JavaScript synchronous.”

It does not.

It provides a cleaner syntax for consuming asynchronous operations.

13. Promise.all vs Promise.allSettled?

Both methods allow you to work with multiple promises, but they have different failure behaviour.

Consider:

const p1 = Promise.resolve("A");
const p2 = Promise.resolve("B");
const p3 = Promise.reject("C");

With:

Promise.all([p1, p2, p3])

the combined promise rejects when one of the promises rejects.

With:

Promise.allSettled([p1, p2, p3])

the operation waits for all promises to settle.

The result contains information about each operation.

Conceptually:

[
  { status: "fulfilled", value: "A" },
  { status: "fulfilled", value: "B" },
  { status: "rejected", reason: "C" }
]

Use Promise.all() when all operations need to succeed for the overall operation to be considered successful.

Use Promise.allSettled() when you need the outcome of every operation, even if some fail.

This distinction is useful in real applications such as dashboard requests, batch processing and independent API calls.

14. What is event bubbling?

Event bubbling is a DOM event behaviour in which an event triggered on a child element can propagate upward through its ancestors.

Suppose you have:

<div id="parent">
  <button id="child">Click</button>
</div>

If the button is clicked, the click event can propagate from the button to its parent.

You can stop propagation using:

event.stopPropagation();

Event bubbling is particularly useful for event delegation.

Instead of attaching listeners to hundreds of child elements, you can attach one listener to a parent and determine which child triggered the event.

A related concept is event capturing.

The simplified propagation model is:

Capturing phase
        ↓
Target
        ↓
Bubbling phase

Understanding bubbling is useful for frontend interviews because it demonstrates that you understand how browser events actually work.

15. Debounce vs throttle?

Both techniques control how frequently a function executes.

Debouncing waits until activity stops before executing the function.

For example, imagine a search box:

User types:
J
Ja
Jav
Java
JavaS
JavaSc
JavaScr
JavaScript

Without debouncing, you could trigger an API request for every keystroke.

With debouncing, the application waits until the user stops typing for a specified period before sending the request.

Typical use cases:

  • Search suggestions
  • Form validation
  • Autosave
  • Resize events

Throttling limits execution to at most once during a defined interval.

Typical use cases:

  • Scroll handlers
  • Mouse movement
  • Window resizing
  • Continuous UI events

The easiest way to remember the difference is:

Debounce waits for silence. Throttle limits frequency.

16. null vs undefined?

Both represent an absence of a meaningful value, but they generally communicate different intentions.

undefined commonly means that a value has not been assigned.

let name;

console.log(name);

Output:

undefined

null is generally used when the developer intentionally assigns “no value.”

let selectedUser = null;

This explicitly indicates that there is currently no selected user.

A useful interview answer is:

undefined generally indicates an absent or uninitialized value, while null is an intentional empty or no-value assignment.

You will often encounter both in APIs and databases, so understanding the distinction is important.

17. What is the prototype chain?

JavaScript uses prototype-based inheritance.

Objects can access properties and methods through their prototype.

For example:

const user = {
  name: "John"
};

console.log(user.toString());

The user object does not necessarily have its own toString() property.

JavaScript looks through the object’s prototype chain to find the property.

Conceptually:

user
 ↓
Object.prototype
 ↓
null

If a property is not found directly on an object, JavaScript looks at its prototype. It continues searching until the property is found or the chain ends.

This mechanism is called the prototype chain.

A common interview question is:

Is JavaScript class-based or prototype-based?

JavaScript provides the class syntax, but the underlying inheritance model is prototype-based.

18. What are ES modules?

ES modules are JavaScript’s standard module system.

You can export functionality:

export function add(a, b) {
  return a + b;
}

And import it elsewhere:

import { add } from "./math.js";

Modules help divide applications into reusable files.

They provide:

  • Encapsulation
  • Reusability
  • Dependency management
  • Better project organisation

Node.js also supports CommonJS, so freshers preparing for Node.js interviews should understand both systems.

Node.js Interview Questions (19–30)

19. What is Node.js?

Node.js is a JavaScript runtime built around Google’s V8 JavaScript engine.

It allows JavaScript to run outside the browser.

This makes JavaScript suitable for:

  • Web servers
  • REST APIs
  • Backend applications
  • Command-line tools
  • Real-time applications
  • Microservices
  • Automation
  • Build tools

Node.js is commonly described as:

  • Event-driven
  • Non-blocking
  • Asynchronous
  • Built around an event loop

One important clarification is that Node.js is not simply “JavaScript on a server.”

It provides a runtime environment with APIs for networking, files, processes, streams, cryptography and other system-level operations.

For example:

const http = require("http");

const server = http.createServer((req, res) => {
  res.end("Hello World");
});

server.listen(3000);

This creates a basic HTTP server.

20. Is Node.js single-threaded?

The best answer is:

JavaScript execution in a typical Node.js application runs on the main thread, but Node.js itself can use additional threads and operating-system facilities for certain operations.

Node.js uses the event loop to handle asynchronous operations efficiently.

libuv also provides a thread pool for certain tasks.

Operations involving areas such as file-system access, DNS and cryptographic work can involve the thread pool depending on the API.

Node.js also provides worker_threads for CPU-intensive JavaScript workloads.

This distinction matters.

If an interviewer asks:

Can Node.js perform parallel work?

The answer is yes, but you should distinguish between:

  • Asynchronous I/O
  • The main JavaScript thread
  • libuv’s thread pool
  • Worker threads
  • Multiple Node.js processes

Node.js is particularly effective for I/O-heavy applications because the main thread does not need to remain blocked while waiting for many external operations.

21. What are the phases of the Node.js event loop?

Node.js’s event loop has several phases.

A simplified representation is:

Timers
   ↓
Pending callbacks
   ↓
Poll
   ↓
Check
   ↓
Close callbacks

Some additional internal processing occurs around these phases, and microtasks are processed between pieces of work.

Important phases include:

Timers

Handles callbacks associated with timers such as:

setTimeout()
setInterval()

Pending callbacks

Handles certain deferred system-level callbacks.

Poll

The poll phase is responsible for retrieving and processing many I/O-related events.

Check

This is where:

setImmediate()

callbacks are executed.

Close callbacks

Handles certain close events, such as socket close notifications.

A fresher does not need to memorise every internal implementation detail. However, you should know the major phases and understand that asynchronous callbacks do not all execute in one generic queue.

22. process.nextTick vs setImmediate?

These two APIs are frequently confused.

process.nextTick() schedules a callback to run after the current operation completes, before the event loop continues with other phases.

Example:

console.log("A");

process.nextTick(() => {
  console.log("nextTick");
});

console.log("B");

Output:

A
B
nextTick

setImmediate() schedules a callback for the event loop’s check phase.

Example:

console.log("A");

setImmediate(() => {
  console.log("immediate");
});

console.log("B");

Output:

A
B
immediate

The key interview distinction is:

process.nextTick() has higher scheduling priority than ordinary event-loop phase callbacks, while setImmediate() runs in the check phase.

Do not simply say that nextTick() is a timer. It is not.

23. CommonJS vs ES modules in Node?

Node.js supports both CommonJS and ES modules.

CommonJS uses:

const express = require("express");

and:

module.exports = router;

ES modules use:

import express from "express";

and:

export default router;

A simplified comparison:

Feature CommonJS ES modules
Import require() import
Export module.exports export
Common extension .js in CommonJS projects .mjs or .js with module configuration
Typical style Traditional Node.js applications Modern JavaScript standard
Browser support Not native browser syntax Native browser module system

In Node.js, project configuration determines how .js files are interpreted.

For example, a package can use:

{
  "type": "module"
}

to treat .js files as ES modules.

24. What are streams?

Streams allow Node.js applications to process data incrementally instead of loading everything into memory at once.

This is especially useful for:

  • Large files
  • Video
  • Audio
  • Network data
  • HTTP requests and responses
  • Data processing pipelines

Node.js provides several major stream types:

  1. Readable
  2. Writable
  3. Duplex
  4. Transform

A readable stream produces data.

A writable stream consumes data.

A duplex stream can both read and write.

A transform stream can modify data as it passes through.

For example, instead of reading a huge file into memory:

const fs = require("fs");

const stream = fs.createReadStream("large-file.txt");

stream.on("data", chunk => {
  console.log(chunk);
});

The application processes chunks of data.

This reduces the amount of memory needed at any one time.

An important interview term here is backpressure.

Backpressure occurs when a data producer is generating data faster than the consumer can process it. Streams provide mechanisms to manage this flow.

25. What is middleware in Express?

Middleware is a function that runs during the request-response lifecycle.

A typical middleware function looks like:

function logger(req, res, next) {
  console.log(req.method, req.url);
  next();
}

You can register it:

app.use(logger);

Middleware can be used for:

  • Logging
  • Authentication
  • Authorization
  • Request parsing
  • Validation
  • CORS handling
  • Rate limiting
  • Error handling

For example:

app.use(express.json());

allows Express to parse incoming JSON request bodies.

Middleware can either:

  • End the response
  • Modify the request or response
  • Pass control to the next middleware

Calling:

next();

passes control forward.

A fresher should also know that error-handling middleware has a different signature:

(err, req, res, next)

26. How do you handle errors in async code?

Error handling depends on how asynchronous code is written.

With async/await:

async function getUser() {
  try {
    const user = await fetchUser();
    return user;
  } catch (error) {
    console.error(error);
  }
}

With promises:

fetchUser()
  .then(user => console.log(user))
  .catch(error => console.error(error));

In Express, you can define error-handling middleware:

app.use((err, req, res, next) => {
  console.error(err);

  res.status(500).json({
    message: "Internal Server Error"
  });
});

The four parameters are important:

(err, req, res, next)

because Express identifies this as error-handling middleware.

A good API should not expose sensitive internal error details to users.

Instead, log detailed information on the server and return an appropriate public error response.

27. What is package.json vs package-lock.json?

package.json describes the project.

It can contain:

  • Project name
  • Version
  • Scripts
  • Dependencies
  • Development dependencies
  • Metadata
  • Module configuration

Example:

{
  "scripts": {
    "start": "node server.js",
    "test": "node --test"
  }
}

package-lock.json records the resolved dependency tree and exact package versions used for installation.

This improves reproducibility.

For example, your package.json may specify a dependency range such as:

"express": "^5.0.0"

while the lock file records the specific versions resolved during installation, together with dependency information.

A useful interview answer is:

package.json describes what the project depends on and how it runs, while package-lock.json records the resolved dependency tree so installations can be reproduced more consistently.

28. What is REST, and how do you build a REST API in Node?

REST, or Representational State Transfer, is an architectural style commonly used for designing web APIs.

REST APIs typically model resources.

For example:

/users
/products
/orders

HTTP methods describe actions.

HTTP method Typical purpose
GET Retrieve
POST Create
PUT Replace/update
PATCH Partially update
DELETE Delete

A basic Express route might look like:

app.get("/users", async (req, res) => {
  const users = await getUsers();

  res.json(users);
});

A POST endpoint could be:

app.post("/users", async (req, res) => {
  const user = await createUser(req.body);

  res.status(201).json(user);
});

A fresher should also understand common HTTP status codes:

Status Meaning
200 Successful request
201 Resource created
204 Successful request with no response body
400 Bad request
401 Authentication required or failed
403 Forbidden
404 Resource not found
409 Conflict
500 Internal server error

One common mistake is treating REST as a specific Node.js library. REST is an architectural style. Express is a framework commonly used to implement HTTP APIs.

29. How do you secure a Node.js API?

Security should be considered throughout the application rather than added at the end.

Important practices include:

Validate input

Never blindly trust data coming from:

  • Request bodies
  • Query parameters
  • URL parameters
  • Headers
  • Uploaded files

Validate data before processing or storing it.

Use HTTPS

Sensitive information should be transmitted over encrypted connections.

Hash passwords

Passwords should never be stored in plain text.

Password hashing algorithms such as bcrypt can be used for password storage.

Protect authentication tokens

JWTs can be useful, but simply using JWT does not automatically make an application secure.

Consider:

  • Token expiration
  • Token storage
  • Secret management
  • Rotation strategies
  • Revocation requirements
  • Authorization checks

Use security headers

Middleware such as Helmet can help configure commonly recommended HTTP security headers.

Rate-limit sensitive endpoints

Rate limiting can reduce abuse against endpoints such as:

  • Login
  • OTP verification
  • Password reset
  • Public APIs

Keep secrets outside source code

Do not hard-code:

const password = "my-secret-password";

Use environment variables or an appropriate secret-management system.

Keep dependencies updated

A Node.js application depends heavily on its package ecosystem, so dependency security matters.

A good fresher answer should demonstrate that API security is not simply about adding JWT.

30. What changed in Node.js 26?

Node.js 26 was released on May 5, 2026. The release includes V8 14.6 and enables the Temporal API by default. It also includes updates to Undici and removes several long-deprecated internal stream modules.

The Temporal API is particularly relevant because it provides a modern date and time API intended to address many limitations of the legacy Date API.

For example, the ecosystem has historically struggled with date manipulation because the older Date API combines several concepts and has awkward handling for time zones and calendar operations.

Node.js 26 also continues the broader trend of bringing more capabilities directly into the runtime.

As of September 30, 2026, Node.js 26 is still the Current release, while Node.js 24 is an LTS release. Node.js 26 is scheduled for LTS promotion in October 2026.

There is also an important upcoming release-model change.

Node.js 27 will be the first major release under the new annual release model. Alpha development is scheduled to begin in October 2026, Node.js 27 is planned for Current release in April 2027 and LTS promotion in October 2027. Every major version will eventually become LTS under the new model.

For an interview, you do not need to list every Node.js 26 change.

A concise answer is enough:

Node.js 26 introduced Temporal enabled by default, moved to V8 14.6, updated several runtime components and removed some long-deprecated APIs. It is currently the Current release and is scheduled to enter LTS in October 2026.

That answer demonstrates that you are aware of current ecosystem changes without turning the interview into a release-note recital.

How to Prepare for a JavaScript Interview as a Fresher

Knowing 30 answers is not enough. You should be able to solve small problems without looking up syntax.

A strong preparation strategy has four layers:

  1. JavaScript fundamentals
  2. Problem-solving
  3. Browser or Node.js concepts
  4. Project-based questions

Master One Programming Language Properly

If JavaScript is your interview language, focus on understanding it deeply.

Revise:

  • Variables
  • Data types
  • Operators
  • Functions
  • Arrays
  • Objects
  • Scope
  • Closures
  • Prototypes
  • Classes
  • Error handling
  • Promises
  • Async/await
  • Modules

Do not spend most of your preparation time memorising obscure JavaScript trivia.

Interviewers are much more likely to test whether you can reason about ordinary code.

Practise Output-Based Questions

Output questions are especially useful because they expose gaps in understanding.

Practise examples involving:

  • var
  • let
  • const
  • Closures
  • Hoisting
  • this
  • Promises
  • setTimeout
  • setImmediate
  • process.nextTick
  • async/await
  • Prototype inheritance

For every snippet, follow this process:

Step 1: Identify synchronous code.

Step 2: Identify asynchronous callbacks.

Step 3: Identify promise microtasks.

Step 4: Identify timers and Node-specific queues.

Step 5: Predict the output.

Step 6: Explain why.

The final step is the most important.

Build One Complete Project

For a fresher, one well-understood project is often more useful than several unfinished projects.

A good MERN project could include:

Frontend
React

Backend
Node.js + Express

Database
MongoDB

Authentication
JWT or session-based authentication

Deployment
Cloud-hosted frontend + backend

Possible projects include:

  • Job portal
  • Expense tracker
  • E-commerce application
  • Learning management system
  • Appointment booking system
  • Task management application
  • Food delivery application
  • Employee management system

The project does not need to be revolutionary.

What matters is whether you understand the decisions you made.

Be ready to answer:

  • Why did you choose MongoDB?
  • Why did you use Express?
  • How does authentication work?
  • How is a password stored?
  • How does the frontend call the backend?
  • What happens when an API fails?
  • How do you validate input?
  • How did you structure the routes?
  • How would you scale the application?
  • What would you change if you rebuilt it?

Learn HTTP and REST

A fresher working with Node.js should know:

  • HTTP request
  • HTTP response
  • Headers
  • Body
  • Query parameters
  • Path parameters
  • Cookies
  • Authentication
  • Authorization
  • Status codes
  • REST
  • JSON
  • CORS

For example:

GET /users
GET /users/25
POST /users
PATCH /users/25
DELETE /users/25

You should understand what each request means rather than simply memorising the method names.

Learn Git

Even when the interview is for JavaScript, Git questions may appear.

Know:

git clone
git status
git add
git commit
git push
git pull
git branch
git merge

Also understand:

  • Pull requests
  • Merge conflicts
  • Branches
  • .gitignore
  • Commit messages

Understand Your Resume

One of the biggest mistakes freshers make is putting technologies on their resume that they cannot explain.

If your resume says:

Node.js
Express
MongoDB
JWT
React
Docker
AWS

the interviewer may ask questions about any of them.

You do not necessarily need expert-level knowledge of every technology, but you should understand everything you claim to have used.

A smaller but truthful skills section is better than a long list of technologies you cannot defend.

A 30-Day JavaScript and Node.js Interview Preparation Plan

Days 1–5: JavaScript Fundamentals

Focus on:

  • Variables
  • Data types
  • Operators
  • Functions
  • Scope
  • Hoisting
  • Arrays
  • Objects
  • Destructuring
  • Spread and rest operators

Write small programs every day.

Do not simply watch tutorials.

Days 6–10: Advanced JavaScript

Focus on:

  • Closures
  • this
  • Prototypes
  • Classes
  • Call/apply/bind
  • Higher-order functions
  • Event bubbling
  • Event delegation
  • Debouncing
  • Throttling

Solve output questions.

Days 11–15: Asynchronous JavaScript

Focus on:

  • Callbacks
  • Promises
  • Promise chaining
  • async/await
  • Promise combinators
  • Event loop
  • Microtasks
  • Timers

Practise at least 20 output-based problems.

Days 16–20: Node.js

Revise:

  • Node.js architecture
  • Event loop
  • libuv
  • Modules
  • CommonJS
  • ES modules
  • Streams
  • Buffers
  • File system
  • Environment variables
  • Error handling
  • npm

Build a small API while studying.

Days 21–24: Express and REST APIs

Learn:

  • Routing
  • Middleware
  • Controllers
  • Validation
  • Error handling
  • Authentication
  • Authorization
  • HTTP status codes
  • REST API structure

Build:

POST /users
GET /users
GET /users/:id
PATCH /users/:id
DELETE /users/:id

Days 25–

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents

Similar Topics

No applications or software are launched on the market without being tested. Software testing projects give you an idea of what to test within an application and how you can...

Categories

Looking to build machine learning skills and land top tech jobs? These 15 hands-on machine learning projects are perfect for final-year CSE students. From Instagram analytics to fraud detection, each...

Categories

If you are a full-stack software developer, learning Data Structures and Algorithms is essential for organizing data and solving problems efficiently. Not only full-stack developers but anyone working in the...

Categories

Chat with us WhatsApp

Choose your
Comfortable place

Complete the form to secure your spot. Our team will contact you with course details, orientation steps, and next actions.

Register & Start Your Learning Journey

Complete the form to secure your spot. Our team will contact you with course details, orientation steps, and next actions.