What Is JavaScript
JavaScript is a programming language used to make web pages interactive. It is the only language that every web browser runs on its own, without a plugin. When you click a button and a menu opens, type in a search box and suggestions appear, or add an item to a cart and the total changes without the page reloading, JavaScript is doing the work.
It is also one of the most widely used languages outside the browser. The same language runs web servers, command-line tools, desktop apps and scripts inside business platforms. Learning it once opens all of those doors.
In One Minute
- JavaScript adds behavior to a web page. HTML gives the page its structure and CSS gives it its look.
- It runs in every browser, and outside the browser in Node.js, Deno and Bun.
- Its official standard is called ECMAScript. A new edition comes out every June; this course teaches ECMAScript 2026.
- JavaScript and Java are different languages. They share part of a name and some syntax, nothing more.
- You need no installation to start: every browser already has a JavaScript engine and a console.
Three Languages, Three Jobs
A web page is built from three languages, and each has one job. Think of a house: HTML is the walls and rooms, CSS is the paint and furniture, and JavaScript is the electricity that makes the lights switch on when you press a switch.
| Language | Job | Example |
|---|---|---|
| HTML | Structure: what is on the page | A heading, a form, a button |
| CSS | Presentation: how it looks | Blue buttons, a two-column layout |
| JavaScript | Behavior: what happens when people use it | Clicking the button adds a payment to a list |
Here is the smallest example of all three working together. The button does nothing until JavaScript gives it something to do:
<button id="pay">Record payment</button>
<p id="status">No payments yet.</p>
<script>
const button = document.querySelector("#pay");
button.addEventListener("click", () => {
document.querySelector("#status").textContent = "Payment recorded.";
});
</script>When the reader clicks Record payment, the text under the button changes to "Payment recorded." The page never reloads. You will learn every line of this in the lessons on the DOM and events.
What JavaScript Can Do
On a web page, JavaScript can:
- Change content: update text, add rows to a table, show or hide a section.
- Change styles: add a CSS class, animate an element, switch to dark mode.
- React to people: clicks, key presses, form input, scrolling, touch.
- Talk to servers: load new data with
fetchwithout reloading the page. - Remember things: save settings in the browser with
localStorage. - Draw: charts and games with the Canvas and SVG.
And outside the browser:
| Where | What people build | Covered in |
|---|---|---|
| Node.js | Web servers, APIs, command-line tools, automation scripts | The Node.js add-on |
| Desktop apps | Apps such as Visual Studio Code are built with JavaScript | Not covered |
| Business platforms | ServiceNow business rules, integration hooks | The platform add-ons |
| Mobile apps | Apps built with React Native | Not covered |
A First Look at the Code
You can run JavaScript right now. The example below prints a message to the console, the text output window that every browser and Node.js provide. Press Try it to run it in your browser.
console.log("Hello from JavaScript!");
console.log(2026 - 1995, "years of JavaScript");Hello from JavaScript!
31 years of JavaScriptconsole.log prints whatever you give it. When you pass several values separated by commas, it prints them on one line with a space between them.
JavaScript Is Not Java
The names are similar for a historical reason: in 1995, when Brendan Eich created the language at Netscape in about ten days, Java was the most talked-about language, and the name was chosen partly for marketing. The two languages work very differently.
| JavaScript | Java | |
|---|---|---|
| Typing | Dynamic: a variable can hold any type of value | Static: every variable has a fixed type |
| How it runs | Source code is run by an engine that compiles it on the fly | Compiled to bytecode first, then run by the JVM |
| Main home | Browsers, Node.js | Servers, Android, enterprise systems |
| Objects | Prototypes (classes are built on top of them) | Classes |
| Functions | Values you can pass around and store | Methods inside classes (plus lambdas) |
ECMAScript: The Standard Behind JavaScript
ECMAScript is the official specification of the JavaScript language. It is written by a committee called TC39, which includes engineers from browser makers and other companies, and published by the standards body Ecma International.
- A new edition is published every year in June. The 17th edition, ECMAScript 2026, was approved on June 30, 2026.
- A new feature goes through five stages (0 to 4). At stage 4 it is finished and goes into the next edition.
- Browsers and Node.js add features as they reach stage 4, often before the edition is published.
People still say "ES6" for the large 2015 update, which brought let, const, arrow functions, classes and modules. Since then, editions are named by year: ES2015, ES2016, and so on up to ES2026.
Common Mistakes
Thinking JavaScript is "Java for the web". The languages share syntax, not design. Code copied from Java usually won't run, and habits from Java (such as expecting == to be strict) cause bugs.
Thinking you need to install something first. You don't. Open your browser's console (the next lessons show how) or press Try it on any example in this course.
Learning from old tutorials without knowing it. Code written before 2015 uses var, function everywhere, and libraries like jQuery for things the language now does on its own. This course teaches the modern way first and shows the older way so you can read it.
Interview Corner
What is JavaScript, and what is it used for?
JavaScript is a dynamically typed, interpreted-and-just-in-time-compiled programming language standardized as ECMAScript. It adds behavior to web pages (responding to events, changing the DOM, calling servers) and is the only language browsers run natively. Outside the browser it runs in Node.js, Deno and Bun for servers, tools and scripts.
What is the difference between JavaScript and ECMAScript?
ECMAScript is the specification published by Ecma International and written by TC39. JavaScript is the language that implements it, plus the environment around it: in a browser that includes the DOM and Web APIs, and in Node.js it includes modules for files and networking. Those environment features are not part of ECMAScript.
Is JavaScript related to Java?
Only by name and some syntax inherited from C. JavaScript is dynamically typed, uses prototypes for objects and treats functions as values; Java is statically typed, class-based and compiled to JVM bytecode.
Practice
Challenge: Write a program that prints your name on one line, and on the next line prints how many days are in 3 weeks, calculated by JavaScript (don't type 21 yourself).
Show solution
console.log("Navika Anamaneni");
console.log(3 * 7, "days in 3 weeks");Navika Anamaneni
21 days in 3 weeksKey Takeaways
| Term | Meaning |
|---|---|
| JavaScript | The language that adds behavior to web pages and runs in Node.js |
| ECMAScript | The specification of the language, one edition per year |
| TC39 | The committee that designs new features |
| Engine | The program that runs JavaScript, such as V8 |
| Console | The output window where console.log prints |
Was this tutorial helpful?