Skip to content

Guide · Open source

How to use es6features: ES6 feature guide and examples

Updated · written with AI from the project's own documentation and checked against our catalogue data

lukehoban/es6features is a written overview of ECMAScript 6, the 2015 update to the JavaScript standard. It walks through the major new features with a short code example for each. This guide explains how to read it and what each feature covers, so you can recognise ES6 syntax in code and decide what to learn first.

ECMAScript 6lukehoban/es6features · ★ 29k · MIT

Quick start

  1. 1Clone the repository. Run the git clone command to download the project to your machine.
  2. 2Open the README. Read the README in the cloned folder, or open the project page online.
  3. 3Scan the feature list. Use the list at the top of the README to find the feature you want to learn.
  4. 4Read a section and its example. Each feature has a short explanation and a JavaScript code sample.
  5. 5Follow the MDN link. Use the linked MDN page for more detail on the feature.
  6. 6Check the specification when needed. For formal rules, use the ECMA-262 standard the README links to.

Get the es6features guide: read online or clone it

The project is a read-online document, and the README has no prerequisites listed. To read it locally, clone the repository with the command below, then open the README in any text or Markdown viewer.

  • Read online: open the project page on GitHub.
  • Read locally: clone the repository first.
git clone https://github.com/lukehoban/es6features

Understand what ES6 is and why it matters

ECMAScript 6, also called ECMAScript 2015, is the first update to the language since ES5 was standardized in 2009. The README notes that implementation in major JavaScript engines was underway, and a compatibility table is linked from the page.

For the full formal specification, the README points to the ES6 standard document (ECMA-262, version 6.0). This overview is a tour, not the specification.

Learn arrow functions and classes

Arrow functions use the => syntax as a shorter way to write functions. They support statement block bodies and expression bodies. Unlike regular functions, arrows share the same lexical this as their surrounding code, which matters when you pass callbacks to methods like forEach.

Classes are described as sugar over the prototype-based pattern. They support inheritance with extends, super calls, instance and static methods, constructors, and getters and setters.

  • Arrows: short callbacks such as evens.map(v => v + 1).
  • Classes: a declarative form with constructor, extends and super.
var bob = { _name: "Bob", _friends: [], printFriends() { this._friends.forEach(f => console.log(this._name + " knows " + f)); } }

Use template strings, destructuring and default parameters

Template strings use backticks and ${name} placeholders for string interpolation. A tag can be added to customise how the string is built, which the README mentions for avoiding injection attacks.

Destructuring binds variables by pattern matching against arrays and objects. It is fail-soft: missing values give undefined, and defaults such as [a = 1] can fill them in. Default, rest and spread parameters let you set fallback values, collect trailing arguments into an array, and spread an array into arguments.

var name = "Bob", time = "today"; `Hello ${name}, how are you ${time}?`

Choose let and const instead of var

let is block-scoped and the README describes it as the new var. const is single-assignment, so reassigning it is an error. The README also notes static restrictions that prevent use before assignment.

The overview also covers iterators with for..of, generators with function* and yield, modules, module loaders, Map, Set, WeakMap, WeakSet, proxies, symbols, promises, the Reflect API and tail calls. Each has a short example in the source.

  • Use let for values that change, const for values that do not.
  • Use for..of to loop over iterable values.

Find the feature you need quickly

The README begins with a list of all features linked to their sections. Scan that list to jump to a feature, then follow the MDN links included under each section for deeper detail.

  • Each section links to an MDN page for more information.
  • Modules and promises are covered in the source, but the README excerpt used for this guide does not reach them in full detail.

What people use it for

  • Reading legacy code that uses arrow functions, classes or template strings.
  • Learning what let and const change compared with var.
  • Teaching students the core syntax of modern JavaScript.
  • Deciding which ES6 features a team should adopt.

Frequently asked questions

Is es6features free to use?

The project is released under the MIT licence, as listed on its page. You can read it online for free or clone it with git.

Do I need to install anything to use es6features?

No. The project is a read-online document and no prerequisites are listed. You only need git if you want a local copy.

Does es6features cover ES2015 and later releases?

No. The README covers only ES6, and the page was last pushed in January 2023. For newer releases, look for a current guide to ES2015 and later.

Where is the full ES6 specification?

The README links to the ES6 standard document (ECMA-262, version 6.0) for the full formal specification. This overview is meant as a quick tour.

What are alternatives to es6features?

Comparable projects mentioned for this topic include Babel, Exploring ES6 by Axel Rauschmayer, and You Don't Know JS.

Is es6features good for beginners?

It suits readers who already know older JavaScript and want a quick tour of ES6 syntax. Students learning modern JavaScript concepts can also use it as a starting point.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use es6features if you know older JavaScript and want a quick, example-driven tour of ES6 syntax, or if you need a reference for legacy code. If you need the formal specification or a current guide to ES2015 and later, pick the ECMA-262 standard or a newer guide such as Exploring ES6 instead.

Install options & downloads