JS: ECMAScript 2015
Over 10 major features are added to the language, effectively making JavaScript a new language.
Here is a quick overview of new features.
let
let is like var , but with a clean block-level scope.
const
const is similar to let, except you can't change its value once set.
Arrow Function
you can write function like this
((x, y) => { return x + y; });
but no this (binding) , and no arguments Object, no Function Name Hoisting .
Function Argument Default Values
function parameter can specify a default value.
Rest Parameters
function can now specify to take any number of parameters, by syntax ...args
Destructuring Assignment
// destructuring assignment let [x, y, z] = [3, 4, 6];
Object Literal Expression, Computed Property Keys
new syntax for object literal to have computed property key by an expression.
obj = {[expression]:value}
Object Literal Expression, Method Definition Shorthand
new syntax shorthand for defining methods in object literal expression.
obj = {
method_name() {body},
etc
};
__proto__
formally recognize the property key __proto__ to get/set parent.
Template String
allows you to embed variable or expression in a string, or have newline char.
Interface, Iterable, Iterator, Generator
Iterable is new. It is a like an delayed array, items are generated at time it is used.
array is made iterable.
iterator is created to support iterable.
for-of loop and spread operator works with iterables.
these are created to support iterable.
- JS: Interface
- Iterator prototype
- JS: Generator
Generator Function is created to support creating iterable.
Set Object
Set object is data structure of set. That is, a collection of unique values.
Map Object
Map object is a data structure of dictionary. Similar to Data Object, but now designed to be used as a data structure, have length, keys can be any type, etc.
Spread Operator
The spread operator is 3 dots:
...xArray
What it does is insert the array items (into a array, or as function args). The operand can be any iterable.
for-of Loop
loop thru an iterable.
Reflect
The Reflect object is used as namespace to host a group
of static functions. Reflect methods typically duplicate operator behavior
in function form, or provides a more strict or improved version of existing
methods.
Class
class is a new keyword that lets you conveniently define object and its prototype.
New keywords are:
class,
constructor,
static,
extends,
super.
regex
New regex flag "u". For unicode. Treat string as sequence of unicode characters.
New regex flag "y". For “sticky”. This means next regex match call will start with lastIndex.
New value properties.
RegExp.prototype.flagsRegExp.prototype.stickyRegExp.prototype.unicode
New function properties.
RegExp.prototype [ Symbol.match ](str)RegExp.prototype [ Symbol.replace ](str, replace)RegExp.prototype [ Symbol.search ](str)RegExp.prototype [ Symbol.split ](str, limit)
New Array Properties
new array constructor properties
- convert array-like and iterable to array.
- JS: Array.from
- function form of array literal expression
- JS: Array.of
new array prototype properties
- JS: Array.prototype.copyWithin
- JS: Array.prototype.fill
- JS: Array.prototype.find
- JS: Array.prototype.findIndex
- JS: Array.prototype.entries
- JS: Array.prototype.keys
- JS: Array.prototype.values
Array.prototype[Symbol.iterator](same as Array.prototype.values)Array.prototype[Symbol.unscopables]
New String Properties
static methods
string methods
String.prototype.localeCompareString.prototype.normalizeString.prototype[Symbol.iterator]
New Object Methods
New Function Properties
function property "name"
New Number Properties
- JS: Number.isFinite
- JS: Number.isInteger
- JS: Number.isNaN
- JS: Number.isSafeInteger
- JS: Number.parseFloat (String to Number)
- JS: Number.parseInt (String to Number)
Number.EPSILONNumber.MIN_SAFE_INTEGERNumber.MAX_SAFE_INTEGER
new Math methods
Math[Symbol.toStringTag]
Math.signMath.truncMath.cbrt
Math.expm1Math.log1pMath.log10Math.log2
Math.hypot
Math.sinhMath.coshMath.tanhMath.asinhMath.acoshMath.atanh
Math.froundMath.clz32Math.imul
html-like comments
formally recognize html comment.
block-level function declaration
now allow function declaration inside a block.
// es2015 block-level function declaration function f() { function g(x) { return x + 1; } return g(1); } console.log(f()); // 2
Module, Keyword “import”, “export”
Unicode Escape Syntax
Now you can escape unicode by
\u{4_to_6_hex_digits}
Octal and binary literals
// octal notation console.log( 0o10 ) // 8 // binary console.log( 0b10 ) // 2
new.target
Promise
- String static methods
- String.prototype methods
- RegExp.prototype properties
Subclassing
- Array is subclassable
- RegExp is subclassable
- Function is subclassable
- Promise is subclassable
- miscellaneous subclassables
Misc
- prototype of bound functions
- Object static methods accept primitives
- own property order
- miscellaneous
Annex b
- Object.prototype.__proto__
- hoisted block-level function declaration
- String.prototype HTML methods
- RegExp.prototype.compile
ArrayBuffer, dataview, typed array
ArrayBufferDataView
Int8ArrayInt16ArrayInt32ArrayUint8ArrayUint16ArrayUint32ArrayUint8ClampedArrayFloat32ArrayFloat64Array
WeakMap, WeakSet
Tail call optimisation (recursion)
JavaScript. ECMAScript New Features
- JS: ECMAScript New Features. 2015 to 2026
- JS: ECMAScript 2015
- JS: ECMAScript 2016
- JS: ECMAScript 2017
- JS: ECMAScript 2018
- JS: ECMAScript 2019
- JS: ECMAScript 2020
- JS: ECMAScript 2021
- JS: ECMAScript 2022
- JS: ECMAScript 2023
- JS: ECMAScript 2024
- JS: ECMAScript 2025
- JS: ECMAScript 2026
- JS: ECMAScript 2027
modern web dev history. 2010 to 2026
- The Ugly JavaScript. 2010 to 2026
- Modern JavaScript Explained For Dinosaurs. By Peter Jang. 2017
- JS: ECMAScript 2015
- JS: CommonJS Module System. 2009 to 2026
- History of JavaScript, 1995 to 2025.
- npm Disease (2021)
- Why was Electron Created (JavaScript framework, 2013)
- JavaScript runtime platforms. 2009 to 2026
- JavaScript package managers. 2012 to 2026
- JavaScript bundlers. 2011 to 2026
- JavaScript UI Frameworks. 2010 to 2026
- JavaScript compilers. 2012 to 2026
- JavaScript task runners. 2012 to 2026
- JavaScript build tools (2026)