# ES5 JavaScript to Modern JavaScript and Modules | gen2.dev

> ES5 code still runs everywhere and the current ECMAScript spec is dated June 2026. What moving to modules and ES2015+ involves, and what breaks.

Source: https://gen2.dev/successors/es5-javascript/

---

Successor Map · Languages and runtimes

# ES5-era JavaScript to modern JavaScript: modules and ES2015 and later

Nothing retired ES5-style JavaScript. The browsers still run it. The move is to let, const, classes, promises and modules, and it can be done one file at a time.

![Slide: ES5 JavaScript on the left, an arrow, and modern JavaScript on the right.](https://gen2.dev/img/successor-es5-javascript.png)

Status of the old tool

Still active

Effort to move

Mechanical

gen2.dev's view

Move when convenient

Sources checked

2026-11-28

## Key facts

Gen 1

![ES5 JavaScript logo](https://gen2.dev/icons/tech/es5-javascript.png)ES5-era JavaScript: script-tag globals, var, function prototypes and callbacks (ECMA-262 5th edition, December 2009)

Gen 2

![JavaScript logo](https://gen2.dev/icons/tech/es6.png)Modern JavaScript: ES modules and ES2015 and later features (ECMA-262 6th edition, June 2015, and every edition since)

Kind of tool

[Languages and runtimes](https://gen2.dev/successors/languages/)

Status of Gen 1

Still active No standards body or browser maker has deprecated ES5 code. MDN describes var as 'well established' and works across many devices and browser versions, with no deprecation notice, and the ECMAScript 2026 specification, 17th edition, is dated June 2026.

Effort to move

Mechanical: same ideas, different calls

What breaks

var and let scope differently, module scripts are deferred and run in their own scope, arrow functions have no this of their own, and code that relied on top-level globals stops finding them.

Should you move?

Move when convenient ES5 code keeps working, so no date is forced, but every feature added since 2015 is built for modules, let, const, classes and promises. This is gen2.dev's view, not the maintainers'.

Sources checked

2026-11-28, [8 sources](#sources)

This is a style change, not a product change, and nobody has switched the old style off.

## What Gen 1 was

ES5 is the JavaScript standard of December 2009, the 5th edition of ECMA-262. The next edition, the 6th, is dated June 2015.

Code from that era has a recognizable shape. Scripts load through plain script tags and share global variables. Variables use `var`. Objects come from constructor functions and their prototypes. Asynchronous work uses callbacks passed into other functions.

A word on "vanilla JavaScript": it means JavaScript with no framework or library. It is not an old version, and vanilla code can use every feature below.

## What replaced it

The 6th edition (ECMAScript 2015) and the editions after it. The Ecma International page now lists the 17th edition, ECMAScript 2026, dated June 2026.

The pieces most code moves to, all documented by MDN:

-   **let and const** instead of `var`. MDN: "`let` declarations are scoped to blocks as well as functions."
-   **Classes** instead of hand-written prototype setup. MDN: "Classes in JS are built on prototypes but also have some syntax and semantics that are unique to classes."
-   **Arrow functions** for short functions that should keep the surrounding `this`.
-   **Promises, async and await** instead of nested callbacks. MDN says await "enables you to write code that uses asynchronous functions but looks like synchronous code."
-   **Modules**, loaded with `<script type="module">`, instead of globals shared between script tags.

## What moving involves

File by file. Nothing requires a rewrite, and the old and new styles can sit in the same codebase, which is the [strangler fig pattern](https://gen2.dev/guide/strangler-fig/) at the scale of a file.

A sensible order, easiest first:

1.  `var` to `const`, and to `let` where the value changes.
2.  Callbacks to promises, then to `async` and `await`.
3.  Constructor functions to classes, where the code reads better for it.
4.  Script-tag globals to modules: give each file `import` and `export` lines, then load the entry file with `type="module"`.

The modules step is the large one, because it changes how files find each other.

## What breaks

Scope. MDN describes `var` as "function-scoped or globally-scoped" and warns that "a variable can appear to be used before it's declared." A `let` in the same position sits in a temporal dead zone and throws a `ReferenceError`. A `let` also cannot be declared twice in one scope, which a `var` allowed.

Modules. MDN says modules "are automatically in strict mode" and "are executed in their own scope, not in the global scope." So a variable one script defined for the others is not visible unless it is exported or attached to `window`. Module scripts "defer by default," so code that expected to run at the point of the tag runs later.

`this`. MDN: "Arrow functions don't have their own bindings to `this`, `arguments`, or `super`, and should not be used as methods." Converting every function to an arrow can break code that depends on how it is called.

Old browsers. The same MDN pages date these features to browser support in 2015 and 2016, so only a codebase that still serves browsers older than that is affected.

## Should you move?

Move when convenient. That is gen2.dev's opinion and the site owner's, not a statement from the standards body.

ES5 code is not unsupported. MDN's page on `var` says the feature "is well established and works across many devices and browser versions," and no source here announces an end date for it. The reason to move is gen2.dev's judgment: modules, `let`, `const` and classes are how the language has been written since 2015, and old code gets harder to share with code written that way.

Do it as you touch files: start with `var` and callbacks, which carry the least risk, and leave the module step for a day when you can test every page. A stable file that works can stay as it is. Write all new code in modern JavaScript.

## Common questions

### Is ES5 JavaScript dead?

No. Its maintainers have not announced an end. No standards body or browser maker has deprecated ES5 code. MDN describes var as 'well established' and works across many devices and browser versions, with no deprecation notice, and the ECMAScript 2026 specification, 17th edition, is dated June 2026.

### What replaced ES5 JavaScript?

Modern JavaScript: ES modules and ES2015 and later features (ECMA-262 6th edition, June 2015, and every edition since). Effort to move: Mechanical: same ideas, different calls

### Should I move off ES5 JavaScript?

gen2.dev's view: Move when convenient. ES5 code keeps working, so no date is forced, but every feature added since 2015 is built for modules, let, const, classes and promises.

## Sources

1.  [ECMA-262 - Ecma International](https://ecma-international.org/publications-and-standards/standards/ecma-262/) - the 5th edition dated December 2009, the 6th edition dated June 2015, and the latest edition, the 17th, ECMAScript 2026, dated June 2026
2.  [JavaScript modules - MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) - that modules are automatically in strict mode, run in their own scope and not the global scope, can be loaded with type="module", and can still read globals from classic scripts
3.  [<script>: The Script element - MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script) - that module scripts defer by default and that the defer attribute has no effect on them
4.  [var - MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var) - that var is function-scoped or globally scoped, how hoisting works, and that it has been available across browsers since July 2015
5.  [let - MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let) - that let is block-scoped, the temporal dead zone, and that a let cannot share a scope with another declaration of the same name
6.  [Arrow function expressions - MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) - that arrow functions have no this of their own and take it from the enclosing scope, and that they have been available across browsers since September 2016
7.  [Classes - MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) - that classes are built on prototypes but have syntax and semantics of their own, and that they have been available across browsers since March 2016
8.  [How to use promises - MDN Web Docs](https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Async_JS/Promises) - the difference between passing a callback in and getting a promise back, and how async and await make asynchronous code read like synchronous code

Sources checked on 2026-11-28. Tools change status quickly; if this date is old, read the sources before acting on it.

## How to do the move

The pattern that fits this kind of replacement:

[Strangler fig pattern](https://gen2.dev/guide/strangler-fig/)

[All successor entries](https://gen2.dev/successors/)

## More in Languages and runtimes

-    [![CoffeeScript logo](https://gen2.dev/icons/tech/coffeescript.png) CoffeeScript to TypeScript Still active A real project Move when convenient](https://gen2.dev/successors/coffeescript/)
-    [![Flow logo](https://gen2.dev/icons/tech/flow.png) Flow to TypeScript Still active A real project Move when convenient](https://gen2.dev/successors/flow/)
-    [![.NET Framework logo](https://gen2.dev/icons/tech/dotnet-framework.png) .NET Framework to .NET Maintenance only A real project Leave it](https://gen2.dev/successors/dotnet-framework/)
-    [![nvm logo](https://gen2.dev/icons/tech/nvm.png) nvm to fnm Still active Drop-in Leave it](https://gen2.dev/successors/nvm/)
-    [![Perl 5 logo](https://gen2.dev/icons/tech/perl.png) Perl 5 to Python Still active A real project Move when convenient](https://gen2.dev/successors/perl/)
-    [![PHP 8.2 and older logo](https://gen2.dev/icons/tech/php-8-2.png) PHP 8.2 and older to PHP 8.4+ Maintenance only Mechanical Move now](https://gen2.dev/successors/php-8-2/)
-    [![Windows Batch logo](https://gen2.dev/icons/tech/windows-batch.png) Windows Batch to PowerShell 7 Still active Mechanical Move when convenient](https://gen2.dev/successors/windows-batch/)

[All languages and runtimes](https://gen2.dev/successors/languages/)
