Back to Home

Base Interview Questions

Core JavaScript, HTML, CSS, Node.js

What is the difference between let, const, and var?
When would you choose each?

Explain the difference between == and === in JavaScript.
Why is === usually preferred?

What is a closure in JavaScript?
Can you give a simple example where a closure is useful?

How does this work in JavaScript?
How is this different inside:

  • a regular function,
  • an arrow function,
  • a method on an object?

What is event bubbling and capturing in the DOM?
How can you stop an event from bubbling?

What is the difference between synchronous and asynchronous code?
Give an example of each in JavaScript.

What are Promises?
How are they different from using callbacks?

What does async/await do?
How would you rewrite a .then().catch() chain using async/await?

What is hoisting in JavaScript?
How does it affect function declarations and variables declared with var?

What is the difference between null and undefined in JavaScript?

What is the difference between shallow copy and deep copy of an object/array?
Give 2 ways to create a shallow copy of an array.

Explain the difference between these array methods and when to use each:

  • map
  • forEach
  • filter
  • reduce

(+) What is the event loop in JavaScript?
How do the call stack, microtask queue (promises), and macrotask queue (timers, DOM events) relate?

(+) What is debouncing and throttling?
Give a real UI example where you’d use each.

What is the difference between block-level and inline elements in HTML?
Give a few examples of each.

What is semantic HTML and why is it important?
Name some semantic elements and what they’re typically used for.

How would you make a web page more accessible?
Mention at least 3 practices (e.g. attributes, structure, ARIA).

What is the difference between:

  • <script src="..."></script>
  • <script type="module" src="..."></script>

When would you use type="module"?

(+) What are some ways to improve web performance on the frontend?
Name at least 3 (e.g. related to images, JS, CSS, network requests).

(+) Explain CORS in simple terms.
When will the browser block a request because of CORS?

What is Node.js and how is it different from running JavaScript in the browser?

How do you read environment variables in Node.js?
Why should secrets (like API keys) usually be stored in env variables and not in code?

How would you handle errors in an Express (or similar) route handler?
Show what happens in sync and async code.

What is npm or pnpm/yarn used for?
What is the difference between a dependency and a devDependency in package.json?

(+) What is the difference between CommonJS (require/module.exports) and ES modules (import/export) in Node.js?

(+) What are some basic ways to protect a Node.js API (or any backend) from common issues, like:

  • too many requests,
  • invalid input,
  • leaking stack traces?

(+) What does “stateless” mean in the context of HTTP APIs?
Why is statelessness usually a good thing for scalability?

(+) How would you structure a simple Node.js project so that: - route handlers, - business logic, - database access
are not all in a single file?