Short answer
JavaScript is a scripting language that browsers run to make pages do more than sit still. It updates content, reacts to clicks, and changes the document through the DOM. The language is standardized as ECMAScript. Java is a different language. In the browser, a script usually runs top to bottom inside the tab, and let, const, and var do not scope names the same way.
Last verified against the sources listed below.
Key takeaways
- JavaScript is the scripting layer next to HTML and CSS. It adds behavior a static page does not have.
- In a browser tab, scripts generally run top to bottom and can change the page through the DOM.
- MDN describes JavaScript as standardized ECMAScript, documented in ECMA-262. The DOM is a separate standard.
- var is function-scoped and hoisted. let and const are block-scoped. const cannot be reassigned.
- The same language can run on a server, for example with Node.js. Browser JavaScript is the client-side case.
- A React component generated from an SVG is JavaScript a page can render, not a separate file format.
A plain answer to what is javascript starts in the browser. MDN’s JavaScript introduction calls it a cross-platform, object-oriented scripting language used to make web pages interactive, with examples such as animations, clickable buttons, and popup menus.
HTML gives a page structure, CSS gives it presentation, and JavaScript gives it behavior. You do not need a full language course to see where it sits. The three ideas below are what pages use it for, how a browser runs it, and how var, let, and const differ.
What do pages use JavaScript for?
Pages use JavaScript when the document has to change after it loads. MDN’s beginner article calls it the third layer of the Web, next to HTML and CSS. JavaScript creates updating content, controls multimedia, and animates images.
A button on that page shows the split in one place. HTML creates the button, CSS styles it, and a script waits for a click, asks for a name, and replaces the text. Scripts also store values, work on strings, and run when an event happens.
Browser APIs sit on that core. The DOM API creates, removes, and changes HTML, and it can apply new styles. MDN also names Geolocation, Canvas, WebGL, and media APIs such as HTMLMediaElement and WebRTC. Third-party APIs are not built in, so you bring that code from the network, while a page of fixed text does not need a script at all.
How does the browser run a script?
The browser downloads the script and runs it inside the tab. MDN calls the tab an execution environment, and client-side code is downloaded, then run by the browser. A block generally runs from top to bottom, so a name must be initialized before a later line uses it.
Swapping two lines in MDN’s button example throws a ReferenceError because the button binding does not exist yet. Each tab is a separate environment, so a script in one tab does not directly change another site. You add the script with an HTML script element, inline or from a file.
MDN calls the language lightweight and interpreted. The browser receives source as text, unlike C or C++, which you compile to machine code ahead of time.
Most modern interpreters also just-in-time compile while the script runs. MDN still calls that interpreted because it happens at run time. Node.js is the server-side host MDN names, and it can talk to a database or files. The browser case is the one that changes the page in front of you.
How do var, let, and const differ?
They all declare bindings, and they do not share the same scope or reassignment rules. Block scope is the short version for let and const. var is function-scoped or global, and a block such as if or for does not create a var scope.
var is hoisted, so the name exists as undefined until the assignment. let and const stay in a temporal dead zone until the declaration runs, and reading them early throws a ReferenceError.
| Keyword | Scope | Reassignment | Before the line | Same scope again |
|---|---|---|---|---|
| var | Function or global | Allowed | Hoisted, undefined | Allowed |
| let | Block and function | Allowed | Temporal dead zone | Not allowed |
| const | Block and function | Binding is fixed | Dead zone, initializer required | Not allowed |
const stops a new assignment, though an object’s properties can still change. A top-level var in a classic script becomes a global property, and let or const does not.
Is JavaScript the same language as Java?
No. The names are related, and the languages are not the same. MDN says JavaScript resembles Java’s expression syntax, naming, and basic control flow, which is why it was renamed from LiveScript, but it does not have Java’s static typing.
Java uses classes declared ahead of time. JavaScript uses a prototype-based object model, so inheritance can vary by object. MDN draws the split this way:
- You do not declare a type for every variable.
- You do not mark methods public, private, or protected.
- Functions can be properties of objects.
MDN also notes that JavaScript does not automatically write to the hard disk, while Java can. If a page needs behavior in the browser, it needs JavaScript or something that compiles to it. web.dev’s function-expressions lesson shows a later JavaScript form, the function expression, including arrow functions introduced in ES6. That syntax is still not Java.
Who standardizes the language?
Ecma International standardizes the language as ECMAScript. The DOM is a separate standard. MDN says the standardized version, called ECMAScript, is meant to behave the same way in applications that support the standard, and the document is ECMA-262.
Ecma’s ECMA-262 page publishes the ECMAScript 2026 specification as the 17th edition, June 2026. MDN is explicit that this specification does not describe the DOM, which the W3C and/or WHATWG standardize. The language itself gives you syntax, objects such as Array, Map, and Math, and control flow.
The WHATWG DOM Standard, last updated 25 November 2026, says the DOM defines a platform-neutral model for events, aborting activities, and node trees. Engines MDN names, SpiderMonkey and V8, implement the language, and the browser wires it to the document. Recent Firefox, Chrome, Edge, and Safari can run the guide’s examples in the console, against the current page.
Where does a generated component fit?
A generated component is still JavaScript that the page can render.
The SVG to JSX tool turns an SVG into a React component. That component is JavaScript a page can render, which puts it in the same layer as any other script that builds part of the interface. It does not change DNS, HTTP, or the DOM standard. It gives you source you can drop into a front-end project instead of keeping the graphic as a separate file the HTML points at.
Planning the page around that script is web design. HTML and CSS can describe a static page. JavaScript is what stores values, listens for events, and updates the DOM after the browser has the document.
Frequently asked questions
When did let and const become widely available?
MDN marks const as widely available since July 2015, and let as widely available since September 2016. var is also marked widely available since July 2015, but it is the older declaration, with function scope and hoisting. Those dates are browser-support notes, not a reason to pick a keyword. Pick const when the binding should stay put, let when you will reassign it, and treat var as the form you are most likely to be reading in older scripts.
What is the temporal dead zone?
A name declared with let or const sits in a temporal dead zone from the start of its block until execution reaches the declaration. Reading it in that gap throws a ReferenceError. A var declared later in the same function reads as undefined instead, because only the declaration is hoisted and the initial value arrives at the assignment. The zone follows execution order, so a function can mention a let name before the line that declares it, as long as the call happens after that line.
Can you reassign properties of a const object?
Yes. MDN says const creates a binding you cannot point at a new value with the assignment operator. If that value is an object or an array, you can still add, update, or remove its properties, or push items into the array. Replacing the whole object throws a TypeError. Freezing the object is a separate step. An initializer is required on the declaration itself, because there is no later assignment that could fill it in.
Does each browser tab run scripts separately?
MDN says each tab has its own execution environment, so code in one tab generally cannot reach code in another tab or on another site. That separation is a security boundary. There are advanced ways to pass data between pages, and the beginner material points at them without teaching them. For ordinary page scripts, assume the tab is the box the code runs in, and that a script you loaded in that tab is what is allowed to change that document.
What does a just-in-time compiler change?
MDN still calls JavaScript an interpreted language because the browser receives the source as text and handles compilation at run time, not ahead of time. Most modern interpreters also just-in-time compile that source into a faster binary form while the script is in use. You do not ship a separate compiled file for ordinary page scripts. The text the browser downloaded is still the program. The speedup happens inside the engine after the page has the script.
Sources
- Introduction · MDN, 2026
- What is JavaScript? · MDN, 2026
- let · MDN, 2026
- const · MDN, 2026
- var · MDN, 2026
- ECMA-262 · Ecma International, 2026
- DOM Standard · WHATWG, 2026
- Function expressions · web.dev, 2026