What is JavaScript?

JavaScript is a programming language used to make applications dynamic.

In the browser, JavaScript makes pages interactive. In Node.js, JavaScript runs backend code on the server.

Why JavaScript exists

HTML gives structure. CSS gives styling. JavaScript gives behavior.

Example:

Where JavaScript runs

JavaScript can run in:

JavaScript in MERN

MERN uses JavaScript across the stack:

Layer Tool
Frontend React
Backend runtime Node.js
Backend framework Express
Database access MongoDB driver or Mongoose

Interview answer

JavaScript is a programming language used for dynamic behavior in web applications. It runs in browsers and also on servers through Node.js. In MERN, JavaScript is used across the stack: React on the frontend, Node and Express on the backend, and MongoDB access through JavaScript libraries.