DEV Community

Sathish A
Sathish A

Posted on

My Node.js - First Interview Experience & Important Concepts!

Hello, friends!!

Today I attended my first Node.js interview round as part of my backend development journey. Since Node.js is closely related to JavaScript, most of the interview questions covered both JavaScript and Node.js basics.

This interview made me realize how important it is to understand core concepts before diving deeper into backend development.

Let me share what I learned and some important topics with short explanations!!

JavaScript & Node.js Topics from the Interview:

1.Function Declaration vs Function Expression:

  • Declaration: You can call the function before it's defined (hoisting).
  • Expression: Stored in a variable; cannot call before definition.

2.setTimeout() in JavaScript:

  • Executes a function after a delay (in milliseconds).

Example:

setTimeout(() => { console.log("Hello after 2 seconds"); }, 2000);
Enter fullscreen mode Exit fullscreen mode

3.Selecting Elements from DOM:

Example:

document.getElementById('id');  
document.querySelector('.class');
Enter fullscreen mode Exit fullscreen mode

4.Async/Await in JS:

  • Makes asynchronous code look synchronous and clean.
  • Used with Promises.

5.Callback Function:

  • A function passed as an argument to another function and executed later.

6.What is Node.js?

  • Runtime environment to run JS outside the browser.
  • Uses Google’s V8 Engine.

7.Why Node.js uses V8 Engine?

  • V8 makes JS execution fast and efficient.

8.Why Node.js is Single-threaded?

  • Handles tasks using Event Loop and Non-blocking I/O, so no need for multiple threads.

9.Can you access DOM in Node.js?

❌ No, because Node.js runs on the server, not in the browser.

10.Simple HTTP Server in Node.js:

const http = require('http');
http.createServer((req, res) => {
  res.write('Hello World');
  res.end();
}).listen(3000);
Enter fullscreen mode Exit fullscreen mode

11.Synchronous vs Asynchronous Functions:

  • Synchronous: Blocks execution.
  • Asynchronous: Does not block execution.

12.HTTP Methods:

  • GET, POST, PUT, DELETE.

13.‘this’ Keyword in JavaScript

  • Refers to the current object.
  • In global scope: window object (browser).

14.undefined vs null

  • undefined: Variable declared but not assigned.
  • null: Assigned as "no value".

15.== vs ===

  • == compares only value (type conversion).
  • === compares value + type (strict).

16.Truthy & Falsy Values:

  • Falsy: 0, "", null, undefined, NaN, false.
  • Everything else is truthy.

17.Global vs Local Scope

  • Global: Accessible everywhere.
  • Local: Accessible only inside functions or blocks.

18.Startup vs Big Companies - My Preference:

1.Startups = Learning, Growth, Multi-tasking
2.Big Companies = Stability, Process, Big Teams
3.For now, I prefer startups to learn and grow fast!

Takeaway for the Day:

"Strong JavaScript knowledge is the foundation for learning Node.js. I’ll keep practicing small tasks daily!"

Learn!!. Build!!. Repeat!!...

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.