A short history of JavaScript
Follow JavaScript from Netscape’s ten-day prototype to ECMAScript, ES5, ES2015, yearly releases, and feature-by-feature browser support.
- 01Tell the story in orderPut Netscape, Brendan Eich, JScript, Ecma, and TC39 in the order they appear.
- 02Read edition namesExplain what ES5 means, and why ES2015 and ES6 are two names for the same edition.
- 03Check real supportCheck whether a browser has one feature, instead of guessing from a version name.
From a quick first version to a standard
The previous lesson, Why JavaScript?, told the short version. JavaScript began at a company called Netscape in 1995. Brendan Eich built it quickly. It got its name while another language, Java, was very popular. This lesson tells that story more slowly.
The goal is not to memorize dates. The goal is to understand names you will see often, like ES5, ES2015, and ES2023. You will also learn why browsers add new parts of the language one at a time.
Here is the main idea in one sentence. JavaScript is the everyday name of the language. ECMAScript is the name of the standard that writes down its core rules. A standard is an official document that everyone agrees to follow.
Browsers follow that standard. Other programs that run JavaScript, called runtimes, follow it too. Each one also adds its own extra tools around the language. The next lesson, Engines, runtimes & hosts, explains those extra tools. This lesson stays with the history of the language.
People sometimes say "this is ES6 code." They usually mean "this code uses features that were added in ES2015." Your browser does not switch into a special ES6 mode. So the useful question today is: "Does this browser support this one feature?"
In this lesson you will:
- click through a timeline of the language,
- compare older ES5-style code with newer ES2015-style code that does the same job,
- sort features by the edition that added them,
- and run real feature checks in your own browser.
Netscape & Brendan Eich
INTERACTIVEIn the mid-1990s, the web was young. Most pages were documents to read, like pages in a book. Netscape Navigator was one of the browsers people used to read them.
Netscape wanted pages to do more. For example, a page could:
- check a form before sending it,
- react when someone clicks,
- and let ordinary page authors add small behaviors, without writing a big program in Java.
Brendan Eich built the first version of the language in about ten days in 1995. Its name changed twice. First it was called Mocha. Then it was renamed LiveScript. Finally it became JavaScript.
The final name was a business choice. Java was a very popular language at the time. Netscape was also working with Sun Microsystems, the company that made Java. That is why people still ask if JavaScript is related to Java. It is not. JavaScript is not a smaller Java. It is its own language.
1995: Brendan Eich builds the first version at Netscape in about ten days, for the Netscape Navigator 2 browser.
Imagine every soccer team used a different rulebook. One team lets players touch the ball with their hands. Another uses a smaller goal. A third gives two points for a fancy kick. Every game would be chaos. The web had the same problem. It needed one shared rulebook, so the same script could work in every browser.
- In real life: The rulebook for a sport
- In JavaScript: The ECMAScript specification
- In real life: The rules committee
- In JavaScript: Ecma International and TC39
- In real life: Teams playing by those rules
- In JavaScript: Browser engines and runtimes implementing JavaScript
- In real life: A referee checking fair play
- In JavaScript: Tests and real websites that show where browsers differ
The ECMAScript standard
RULEBOOKNetscape was not the only company making a browser. In 1996, Microsoft added its own copy of the language to Internet Explorer. Microsoft called it JScript. Now two companies each had their own version.
That was a risk. If the two versions grew apart, page authors would need one script for Netscape and a different script for Internet Explorer.
To prevent that, Netscape gave the language to Ecma International, a group that writes standards. Inside Ecma, a committee called TC39 looks after the language today. A committee is a group of people who meet to make decisions together.
In June 1997, Ecma published the first edition of the standard, called ECMAScript 1. An edition is one published version of the standard.
Why a new name? "JavaScript" was a trademark: a brand name that one company owned. The standard needed a neutral name that any company could use. That is why official documents say ECMAScript, while developers usually say JavaScript.
Each row below is one name from this story. Read across to see what it means, and then a simpler way to say it.
| Name | What it means | In simpler words |
|---|---|---|
| JavaScript | The everyday name of the language. Developers and browsers use it. | What you write in .js files. |
| ECMAScript | The official standard for the core language. Ecma and TC39 write it. | The written rules that everyone shares. |
| TC39 | The committee that updates the ECMAScript standard. | The people who decide on new rules. |
| Implementation | A browser's or runtime's working version of those rules. | A program that follows the rules and runs your code. |
Two more editions came quickly: ES2 in 1998 and ES3 in 1999. ES3 then stayed the main edition for about ten years.
Work started on a very big ES4. It tried to change too much at once, and it was given up in 2008. After that, TC39 chose a more practical path. It improved the language in smaller steps that browsers could really build.
"ES" is short for ECMAScript. So ES5 means ECMAScript 5. ES2015 means the edition of ECMAScript published in 2015.
ES5 and ES2015: two big editions
STEP THROUGHES5 came out in 2009. It cleaned up the language after the long ES3 years. It added:
- strict mode, a setting you turn on by writing
"use strict". It turns some silent mistakes into errors. - built-in support for JSON, a text format for data (explained below).
- array helpers such as
forEach,map, andfilter. Each one runs a function for every item in an array. Object.defineProperty, a tool for setting up one property of an object in detail.
ES5.1 came in 2011. It was a small edition. It mostly fixed the wording, so the text matched the international ISO version of the standard.
var orderText = '{"item":"tea","count":2}';var order = JSON.parse(orderText);console.log(order.item);JSON is a text format for sending simple data between programs. It looks like a JavaScript object written inside a string.
Line 1 stores an order as JSON text. Line 2 uses JSON.parse, which ES5 added. It turns the text into a real object. Line 3 reads the object's item property and prints tea. Web apps still use JSON everywhere, so this ES5 tool is still useful today.
ES2015 was a much bigger update. People often call it ES6, because it was the sixth edition. It added things you will use all the time:
letandconst, for making variables,- arrow functions, a shorter way to write a function,
- classes, a way to describe many similar objects,
- template literals, strings that can hold values inside
${}, - modules, for splitting code into separate files,
- promises, for work that finishes later,
- and destructuring, for copying values out of an object into variables.
You don't need to learn all of these today. Just notice what changed. JavaScript kept everything it could already do. It also gained clearer ways to write common things.
const profile = { name: "Asha", city: "Pune" };const { name } = profile;console.log(name);Line 1 makes a small profile object. Line 2 uses destructuring. This ES2015 syntax copies the name property into a new variable, also called name. Line 3 prints Asha.
You could write profile.name instead. Both read the same value. Destructuring is just shorter when you need the value many times.
Switch between ES5 style and ES2015 style. Guess the output first: both versions should print the same message.
script
var makeGreeting = function (name) { var message = "Hello, " + name + "!"; return message;}; Changing a setting starts a new recording. For the same name, both styles print the same result.
The replay is simple on purpose. In both styles, the code:
- takes a name,
- builds the same greeting,
- and prints the same result.
ES2015 did not swap JavaScript for a new language. It gave developers nicer ways to do things they already did.
const cart = ["tea", "milk"];var labels = cart.map(function (item) { return item.toUpperCase();}).join(", ");console.log(labels);Line 1 makes a cart. Lines 2 and 3 use map to make an uppercase label for each item. map runs a function once for each item. A function that you hand to another function like this is called a callback. Line 4 uses join to put the labels into one string. Line 5 prints TEA, MILK.
var and the function callback are an older style. You will still see them in articles and in real projects. Newer code might use const and an arrow function instead. The work done on the array is the same.
A new edition every year
SORTAfter ES2015, TC39 started publishing a new edition every year. Since 2016, each edition gathers the features that are finished and ready. It usually comes out in June. So the language gets small, steady updates, instead of one huge update every ten years.
Your phone does not wait ten years for one giant upgrade. It gets regular, smaller updates. Modern JavaScript works the same way. It gets a steady stream of small improvements. Each year it is still the same language, just a little better.
- In real life: A phone gets a software update every year
- In JavaScript: ECMAScript gets a new edition every year
- In real life: Small new features arrive regularly
- In JavaScript: Array
includes, async functions, optional chaining,.at(),toSorted - In real life: An older phone may get an update later than others
- In JavaScript: A browser may add a feature some time after the edition comes out
Here are a few features, by the edition that added each one. You don't need to know them yet. Some of them appear in the examples below.
- ES2016:
Array.prototype.includes, and**for powers (2 ** 3is 8). - ES2017: async functions and
await, for waiting on slow work. - ES2020: optional chaining
?., nullish coalescing??, andBigIntfor very large whole numbers. - ES2022: top-level
await,.at(), and public class fields. - ES2023:
toSortedandfindLast.
Array.prototype.includes is the full name of the includes method that every array has. You will see full names like this in documentation and in feature checks.
const cart = ["tea", "milk"];const hasTea = cart.includes("tea");console.log(hasTea);Line 1 lists two cart items. Line 2 uses includes, which ES2016 added to arrays. It asks: is "tea" in the list? Line 3 prints true.
Most new features look like this. They make one ordinary task a little easier. You don't have to learn a new language.
const user = { name: "Asha" };const city = user.profile?.city ?? "No city";console.log(city);Line 1 makes a user with no profile property. Line 2 uses two newer tools:
?.is optional chaining. Ifuser.profileis missing, it stops and givesundefined, instead of throwing an error.??is nullish coalescing. If the left side isnullorundefined, it uses the right side,"No city".
Line 3 prints No city. Use this for data that may really be incomplete. Don't use it to hide a bug when a value should always be there.
const cart = ["tea", "milk"];console.log(cart.at(-1));Line 1 makes the same cart. Line 2 uses at(-1), an ES2022 method. A negative number counts from the end, so -1 means the last item. Line 2 prints milk.
Before at, you would write cart[cart.length - 1]. Both work. at(-1) is often easier to read.
- Mocha is renamed LiveScript, then JavaScript
- The first ECMAScript standard
"use strict";- Built-in
JSON.parseandJSON.stringify const double = n => n * 2;- Template literals:
Hello, ${name}! [1, 2, 3].includes(2)user.profile?.name ?? "Guest"items.toSorted()
Put each name or feature in the era that added it. If you pick the wrong era, the card tells you the right year. Treat it as a study game.
Ask about features, not versions
REAL BROWSERBeginners often ask: "Which JavaScript version does my browser support?" A smaller question is more useful: "Does this browser support the feature I want to use?"
Here is why. An edition is one version of the written standard. It is not a switch that a browser turns on all at once. Each browser team adds features on its own schedule. People also update their browsers at different times. So a browser can have some features from an edition and not others.
includes() and at(), but not toSorted(). So ask about the feature you need, not about a whole edition.A shopping list has many separate items. When you need milk, you check for milk. You don't ask whether the whole list is there.
- In real life: Check whether milk is on today's list
- In JavaScript: Check whether this browser supports
toSorted - In real life: One missing item doesn't mean the whole list is gone
- In JavaScript: One missing method doesn't remove the other features
Checking for one feature in code is called feature detection. The playground below runs six checks in your browser. Each check uses one of two tools:
typeof Array.prototype.at === "function"asks: isata function I can call?typeofgives the type of a value as text, such as"function"."toSorted" in Array.prototypeasks: do arrays have a method namedtoSorted?inchecks whether an object has a property with that name.
const checks = { arrayAt: typeof Array.prototype.at === "function", toSorted: "toSorted" in Array.prototype, objectGroupBy: typeof Object.groupBy === "function", structuredClone: typeof structuredClone === "function", replaceAll: "replaceAll" in String.prototype, setUnion: typeof Set.prototype.union === "function",};typeof Array.prototype.at === "function"
A newer array method that reads an item by its position. -1 means the last item.
"toSorted" in Array.prototype
An ES2023 method that sorts a copy and leaves the original array alone.
typeof Object.groupBy === "function"
An ES2024 helper that puts items into groups. Some older browsers don't have it yet.
typeof structuredClone === "function"
A tool for copying values. Browsers and runtimes add it; it is not part of ECMAScript.
"replaceAll" in String.prototype
An ES2021 string method that replaces every match, not just the first one.
typeof Set.prototype.union === "function"
An ES2025 Set method that joins two sets into a new set.
Reset hides the answers. Run the checks to ask about one feature at a time.
The step-through below runs the same six checks, one at a time. Each answer comes from this browser. Another visitor, with another browser, may get different answers.
Step through six real checks. Each one asks about one feature. None of them gives the whole browser a version number.
script
const supportsToSorted = "toSorted" in Array.prototype;const supportsGroupBy = typeof Object.groupBy === "function";const supportsStructuredClone = typeof structuredClone === "function";const supportsReplaceAll = "replaceAll" in String.prototype;const supportsSetUnion = typeof Set.prototype.union === "function";console.log(supportsToSorted);One check is different. structuredClone makes a full copy of a value. You call it from JavaScript, but it is not part of ECMAScript. The browser or runtime adds it as an extra tool.
This leads into the next lesson. There you will meet the engine, the part that runs the language, and the host, the browser or runtime around the engine that adds extra tools.
Where you’ll use this
History is useful when you read code, when you choose what to write, and when code fails in one browser.
Older tutorials often use var and the function keyword. Newer examples often use const, arrow functions, template literals, and optional chaining. If you know the timeline, you can tell the old style from the new style. Both still work.
When you use a newer method, plan a fallback. A fallback is a second way to do the same job, for browsers that don't have the new method. In the example below, both ways sort a copy, so the original scores keep their order.
Line 2 holds the answer from a feature check, like the ones above. Here it is set to false, so the code takes the fallback way.
const scores = [8, 3, 5];const canUseToSorted = false;const sorted = canUseToSorted ? scores.toSorted((left, right) => left - right) : [...scores].sort((left, right) => left - right);console.log(scores.join(", "));console.log(sorted.join(", "));Line 1 makes scores. Line 2 stands for the result of a feature check. Lines 3 to 5 pick one of two ways to sort. The ? and : work like a short if/else:
- If
canUseToSortedistrue, line 4 runs. It usestoSorted. - If it is
false, line 5 runs.[...scores]copies every item into a new array. Thensortsorts that copy.
On both lines, (left, right) => left - right tells the sort to put smaller numbers first. Lines 6 and 7 print the original, 8, 3, 5, and then the sorted copy, 3, 5, 8.
const scores = [8, 3, 5];const sorted = scores.toSorted((left, right) => left - right);console.log(scores.join(", "));console.log(sorted.join(", "));Line 1 makes a list of scores. Line 2 uses toSorted, from ES2023, to make a sorted copy. Line 3 prints 8, 3, 5. Line 4 prints 3, 5, 8.
This difference matters in a real page. sort() changes the original array. toSorted() leaves the original as it was and gives you a new, sorted array.
const cart = new Set(["tea"]);const extras = new Set(["milk", "tea"]);const items = typeof cart.union === "function" ? cart.union(extras) : new Set([...cart, ...extras]);console.log([...items].join(", "));A Set is a list that keeps each value only once. Lines 1 and 2 make two sets. Both of them hold "tea".
Lines 3 to 5 join the two sets. If cart has the new ES2025 union method, line 4 uses it. If not, line 5 copies both sets into one new set. Line 6 prints tea, milk. The repeated tea appears only once. A fallback makes sense here because union is very new.
Each row of the table below is a situation you may meet. Read across: first the situation, then a better question to ask, then what to do. MDN and caniuse are websites that show which browsers support each feature.
| When this happens | Ask this question | Then do this |
|---|---|---|
You see var in old code. | Is it just old style, or does the code rely on var belonging to the whole function? | Read it first. Change it to the newer style only when tests check that the code still works. |
You want to use toSorted. | Do the browsers I care about support Array.prototype.toSorted? | Check MDN or caniuse, or write a fallback. |
| A tool says it turns modern JavaScript into older JavaScript. | Which features does it change? | Look at which browsers the tool is set up for, not just an ES label. |
| A snippet fails in one browser. | Which exact feature is missing? | Check for that feature, or rewrite that part of the code. |
You will see this most when you copy code from documentation. A page might show const names = users.map(user => user.name). You know that const and arrow functions came in ES2015. So you can tell this is newer syntax for ordinary steps: store a value, call a function, and return a result.
Build tools are programs that prepare your code before it goes to the browser. Some of them can rewrite new syntax as older syntax. But they can't always add a missing method. Rewriting an arrow function as a normal function is easy. Adding toSorted to a browser that doesn't have it is a different job. So check your build tool's settings and the exact feature.
Say "this code uses optional chaining," not "this code is ES2020." Support websites, documentation, and error messages all talk about features by their names.
Common misconceptions
"JavaScript and ECMAScript are two different languages."
They are two names for the same core language. JavaScript is the everyday name. ECMAScript is the name of the standard that writes down the core rules.
"ES6 replaced old JavaScript."
ES2015, also called ES6, added features. It didn't remove old ones. Old code still works, because the web needs old pages to keep working.
"A browser supports all of ES2023 or none of it."
Support comes one feature at a time. A browser can have one new method and still be missing another. It can also be missing an extra tool that browsers add, which is not part of the standard at all.
"If a feature is in the standard, every browser has it right away."
Writing a rule and building it are two separate steps. Browser teams need time to build each feature. People need time to update their browsers.
"Newer syntax is always better."
Newer syntax is often clearer. But browser support, your team's style, and how easy the code is to read matter too. Choose what solves the problem.
Each row of the table below is a name people often mix up. Read across: first the common mistake, then what the name really means.
| Name | What people often think | What it really means |
|---|---|---|
| ES5 | Any old JavaScript. | The fifth edition, from 2009, and the features it added. |
| ES6 | A different language. | Another name for ES2015, the sixth edition. |
| Modern JavaScript | One exact version. | A loose phrase for newer features that most browsers now support. |
| Browser support | A yes-or-no answer for a whole edition. | A yes-or-no answer for each feature, one at a time. |
Practice: read history like a developer
5 EXERCISESFollow this tiny program line by line. What does it print?
var tool = "Mocha";
tool = "LiveScript";
console.log(tool);It prints LiveScript. Line 1 stores Mocha in tool. Line 2 replaces it with LiveScript. Line 3 prints the current value.
Type these four names from earliest to latest: ES2015, Mocha, ES5, ECMAScript.
The order is Mocha, ECMAScript, ES5, ES2015. Mocha was the first name, in 1995. ECMAScript 1 came out in 1997. ES5 came in 2009, and ES2015 in 2015.
People say ES5, ES2015, and ES2023. What does the ES stand for?
ES stands for ECMAScript. That is the standard that writes down the core rules of JavaScript.
A teammate asks, "Can we use ES2023?" The code only needs Array.prototype.toSorted. Rewrite the question so it asks about that one feature.
Ask: Does this browser support Array.prototype.toSorted? A question about one feature has a clear answer. You can look it up on MDN or caniuse, and add a fallback if you need one.
This code makes a sorted copy and leaves the original array as it was. Which feature should you check before you rely on it in older browsers?
const scores = [3, 1, 2];
const sorted = scores.toSorted();
console.log(scores.join(","));
console.log(sorted.join(","));const scores = [3, 1, 2];
const sorted = scores.toSorted ? scores.toSorted() : [...scores].sort();
console.log(scores.join(","));
console.log(sorted.join(","));Check toSorted. It is useful because it leaves the original array unchanged. But older browsers may not have it. A fallback is to copy the array first and then sort the copy: [...scores].sort().
Quiz: check your understanding
8 QUESTIONSAnswer each question from memory first. Then read every explanation. Wrong answers help too: each one names a common mix-up.
Question 1 of 8Who created the first version of JavaScript at Netscape?
Choose an answer to see the explanation.
Question 2 of 8What does the name ECMAScript refer to?
Choose an answer to see the explanation.
Question 3 of 8What does this code print?
Read the code, then predictvar label = "ES"; label = label + "2015"; console.log(label);Choose an answer to see the explanation.
Question 4 of 8Which name means the same edition as ES2015?
Choose an answer to see the explanation.
Question 5 of 8Which feature came with ES2015, not ES5?
Choose an answer to see the explanation.
Question 6 of 8This code checks a list for one item. What does it print?
Read the code, then predictconst features = ["ES5", "ES2015"]; console.log(features.includes("ES2015"));Choose an answer to see the explanation.
Question 7 of 8Why is feature detection, checking for one feature in code, useful?
Choose an answer to see the explanation.
Question 8 of 8How often does a new ECMAScript edition come out today?
Choose an answer to see the explanation.
Key takeaways
- JavaScript began at Netscape in 1995. Brendan Eich built the first version quickly, so web pages could run small scripts.
- ECMAScript is the standard that writes down the core rules of the language. TC39 is the committee that updates it.
- ES5, from 2009, cleaned up the language. ES2015, also called ES6, was a big update with lots of new syntax.
- Since 2016, a new, smaller edition comes out every year, usually in June.
- Check support one feature at a time. Ask whether the browser supports the exact method, syntax, or tool you plan to use.
Remember the one-liner.
JavaScript is the name of the language. ECMAScript is its written standard. Browsers add the standard's features one at a time.
Up next: Engines, runtimes & hosts.