What Is JavaScript

Updated · 7 min read
easyES2026javascriptbasicsecmascriptinterview

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.

LanguageJobExample
HTMLStructure: what is on the pageA heading, a form, a button
CSSPresentation: how it looksBlue buttons, a two-column layout
JavaScriptBehavior: what happens when people use itClicking 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:

index.html
<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 fetch without 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:

WhereWhat people buildCovered in
Node.jsWeb servers, APIs, command-line tools, automation scriptsThe Node.js add-on
Desktop appsApps such as Visual Studio Code are built with JavaScriptNot covered
Business platformsServiceNow business rules, integration hooksThe platform add-ons
Mobile appsApps built with React NativeNot 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.

hello.js▶ Try it
console.log("Hello from JavaScript!");
console.log(2026 - 1995, "years of JavaScript");
Output
Hello from JavaScript!
31 years of JavaScript

console.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.

JavaScriptJava
TypingDynamic: a variable can hold any type of valueStatic: every variable has a fixed type
How it runsSource code is run by an engine that compiles it on the flyCompiled to bytecode first, then run by the JVM
Main homeBrowsers, Node.jsServers, Android, enterprise systems
ObjectsPrototypes (classes are built on top of them)Classes
FunctionsValues you can pass around and storeMethods 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
practice.js▶ Try it
console.log("Navika Anamaneni");
console.log(3 * 7, "days in 3 weeks");
Output
Navika Anamaneni
21 days in 3 weeks

Quick check: What is JavaScript

3 questions
1On a web page, what is JavaScript's job?
2What is ECMAScript?
3Which statement about JavaScript and Java is true?

Key Takeaways

TermMeaning
JavaScriptThe language that adds behavior to web pages and runs in Node.js
ECMAScriptThe specification of the language, one edition per year
TC39The committee that designs new features
EngineThe program that runs JavaScript, such as V8
ConsoleThe output window where console.log prints

Was this tutorial helpful?

Lesson 1 of 139