Skip to content

Latest commit

 

History

History
319 lines (277 loc) · 17.6 KB

ecma-script.md

File metadata and controls

319 lines (277 loc) · 17.6 KB

Describe which new features have been added by version.

ESNext refers to the next upcoming version.

See kangax, Mozilla Developer Network and CanIUse.com for browser support.

sources

5

2009

  • "use strict"
  • String.trim()
  • Array
    • Array.isArray()
    • Array.forEach()
    • Array.map()
    • Array.filter()
    • Array.reduce()
    • Array.reduceRight()
    • Array.every()
    • Array.some()
    • Array.indexOf()
    • Array.lastIndexOf()
  • JSON
    • JSON.parse()
    • JSON.stringify()
  • Date
    • Date.now()
    • date.valueOf()
  • Property Getters and Setters
  • New Object Property Methods
    • Object.defineProperty()

Syntax

  • Property access [ ] on strings
  • Trailing commas in array and object literals
  • Multi-line string literals
  • Reserved words as property names

2015

Also known as ES6. No IE11 support except through polyfills. language spec

  • Destructuring Assignment
  • Spread Operator
  • Rest Parameters
  • Default parameters
  • Arrow Functions
  • Template Literals
  • Object Literals
  • Classes
    • Not “traditional” classes, syntax sugar on top of prototypal inheritance
  • let and const
  • Symbols
    • A new primitive type in ES6
  • Iterators
    • define how to iterate over any object, not just arrays and array-likes
  • Generators
    • a special kind of iterator that can be declared using the function* generator () {} syntax
  • Promises
  • Maps
  • WeakMaps
  • Sets
  • WeakSets
  • Proxies
  • Reflection
    • Full reflection API exposing the runtime-level meta-operations on objects. This is effectively the inverse of the Proxy API, and allows making calls corresponding to the same meta-operations as the proxy traps. Especially useful for implementing proxies.
  • Number
    • Number.isNaN and Number.isFinite are like their global namesakes, except that they don’t coerce input to Number
    • Number.parseInt and Number.parseFloat are exactly the same as their global namesakes
    • Number.isInteger checks if input is a Number value that doesn’t have a decimal part
    • Number.EPSILON helps figure out negligible differences between two numbers – e.g. 0.1 + 0.2 and 0.3
    • Number.MAX_SAFE_INTEGER is the largest integer that can be safely and precisely represented in JavaScript
    • Number.MIN_SAFE_INTEGER is the smallest integer that can be safely and precisely represented in JavaScript
    • Number.isSafeInteger checks whether an integer is within those bounds, able to be represented safely and precisely
  • Math
    • Math.sign – sign function of a number
    • Math.trunc – integer part of a number
    • Math.cbrt – cubic root of value, or ∛‾value
    • Math.expm1 – e to the value minus 1, or evalue - 1
    • Math.log1p – natural logarithm of value + 1, or ln(value + 1)
    • Math.log10 – base 10 logarithm of value, or log10(value)
    • Math.log2 – base 2 logarithm of value, or log2(value)
    • Math.sinh – hyperbolic sine of a number
    • Math.cosh – hyperbolic cosine of a number
    • Math.tanh – hyperbolic tangent of a number
    • Math.asinh – hyperbolic arc-sine of a number
    • Math.acosh – hyperbolic arc-cosine of a number
    • Math.atanh – hyperbolic arc-tangent of a number
    • Math.hypot – square root of the sum of squares
    • Math.clz32 – leading zero bits in the 32-bit representation of a number
    • Math.imul – C-like 32-bit multiplication
    • Math.fround – nearest single-precision float representation of a number
  • Array
    • Array.from – create Array instances from array-like objects like arguments or iterables
    • Array.of – similar to new Array(...items), but without special cases
    • Array.prototype.copyWithin – copies a sequence of array elements into somewhere else in the array
    • Array.prototype.fill – fills all elements of an existing array with the provided value
    • Array.prototype.find – returns the first item to satisfy a callback
    • Array.prototype.findIndex – returns the index of the first item to satisfy a callback
    • Array.prototype.keys – returns an iterator that yields a sequence holding the keys for the array
    • Array.prototype.values – returns an iterator that yields a sequence holding the values for the array
    • Array.prototype.entries – returns an iterator that yields a sequence holding key value pairs for the array
    • Array.prototype[Symbol.iterator] – exactly the same as the Array.prototype.values method
  • Object
    • Object.assign – recursive shallow overwrite for properties from target, ...objects
    • Object.is – like using the === operator programmatically, except it’s true for NaN vs NaN and false for +0 vs -0
    • Object.getOwnPropertySymbols – returns all own property symbols found on an object
    • Object.setPrototypeOf – changes prototype. Equivalent to Object.prototype.__proto__ setter
  • Strings & Unicode
    • String.prototype.startsWith – whether the string starts with value
    • String.prototype.endsWith – whether the string ends in value
    • String.prototype.includes – whether the string contains value anywhere
    • String.prototype.repeat – returns the string repeated amount times
    • String.prototype[Symbol.iterator] – lets you iterate over a sequence of unicode code points (not characters)
    • String.prototype.codePointAt – base-10 numeric representation of a code point at a given position in string
    • String.fromCodePoint – given ...codepoints, returns a string made of their unicode representations
    • String.prototype.normalize – returns a normalized version of the string’s unicode representation
  • Modules
    • Strict Mode is turned on by default in the ES6 module system
    • ES6 modules are files that export an API
    • export default value exports a default binding
    • export var foo = 'bar' exports a named binding
    • Named exports are bindings that can be changed at any time from the module that’s exporting them
    • export { foo, bar } exports a list of named exports
    • export { foo as ponyfoo } aliases the export to be referenced as ponyfoo instead
    • export { foo as default } marks the named export as the default export
    • As a best practice, export default api at the end of all your modules, where api is an object, avoids confusion
    • Module loading is implementation-specific, allows inter-operation with CommonJS
    • import 'foo' loads the foo module into the current module
    • import foo from 'ponyfoo' assigns the default export of ponyfoo to a local foo variable
    • import {foo, bar} from 'baz' imports named exports foo and bar from the baz module
    • import {foo as bar} from 'baz' imports named export foo but aliased as a bar variable
    • import {default} from 'foo' also imports the default export
    • import {default as bar} from 'foo' imports the default export aliased as bar
    • import foo, {bar, baz} from 'foo' mixes default foo with named exports bar and baz in one declaration
    • import * as foo from 'foo' imports the namespace object
      • Contains all named exports in foo[name]
      • Contains the default export in foo.default, if a default export was declared in the module
  • For..of
  • For..in
  • RegExp u mode
  • Sub-classable Built-ins
    • built-ins like Array, Date and DOM Elements can be sub-classed
  • Binary and Octal Literals
    • 0b111110111 === 503 // true
    • 0o767 === 503 // true
  • Tail Calls
    • Calls in tail-position are guaranteed to not grow the stack unboundedly. Makes recursive algorithms safe in the face of unbounded inputs
  • HTML-style comments

2016

language spec

2017

language spec

2018

language spec

2019

language spec

2020

language spec

2021

language spec

  • String.prototype.replaceAll
  • numeric separators
  • Promise.any
    • fulfillment
    • AggregateError
  • WeakReferences
    • WeakRef minimal support
    • FinalizationRegistry minimal support
  • Logical Assignment
    • ||= basic support
    • ||= short-circuiting behavior
    • ||= setter not un-necessarily invoked
    • &&= basic support
    • &&= short-circuiting behavior
    • &&= setter not un-necessarily invoked
    • ??= basic support
    • ??= short-circuiting behavior
    • ??= setter not un-necessarily invoked

2022

language spec

2023


next