Skip to content

Instantly share code, notes, and snippets.

@aweary
Last active January 27, 2017 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aweary/d3eb00c2114a337e13cc39e26abddcf2 to your computer and use it in GitHub Desktop.
Save aweary/d3eb00c2114a337e13cc39e26abddcf2 to your computer and use it in GitHub Desktop.

ECMA262 - TL;DR

A pocket-size summary of the ECMA262 specification

ECMAScript DataTypes and Values

Every value has an associated type. This section exactly defines the possible types. Types are subclassed into ECMAScript language types and specification types.

When you see Type(x) it means "the type of x where "type" refers to the ECMAScript language and specification types defined here. "empty" means "no value of any type"

6.1 ECMAScript Language Types

The Undefined type has exactly one value, called undefined. Any variable that has not been assigned a value has the value undefined.

The Null type has exactly one value, called null.

The Boolean type represents a logical entity having two values, called true and false.

The String type is the set of all ordered sequences of zero or more 16-bit unsinged integer values ("elements") up to a maximum length of 2^53-1 elements. Represents textual data. Each element is treated as a UTF-16 code unit value. Each element is occupies an zero indexed position in the sequence.

The Symbol type is the set of all non-String values that may be used as the key of an Object property. Each possible Symbol is unique and immutable. Each Symbol value immutably holds an associated value called [[Description]] that is either undefined or a String value.

@TODO: Create a table with all well-known symbols.

The Number type has exactly 18437736874454810627 values, representing the double-precision 64-bit IEEE 754-2008 values as specified in the IEEE Standard for Binary Floating-Point Arithmetic, except that the 9007199254740990 distinct "Not-a-Number" values of the IEEE Standard are represented in ECMAScript as a single special NaN value.

There are also two other special values called positive Infinity and negative Infinity. The other 18437736874454810624 numbers are called the finite numbers. Half of these are positive and half are negative. Note there is also +0 and -0 respectively.

An Object is logically a collection of properties. Each property is either a data property, or an accessor property.

  • A data property associates a key value with an ECMAScript language value and a set of Boolean attributes
  • An accessor property associates a key value with one or two accessor functions, and a set of Boolean attributes. The accessor functions are used to store or retrieve an ECMAScript language value that is associated with the property.

Properties are identified using key values, which is either a String or a Symbol value. All String and Symbol values, including the empty string, are valid as property keys. A property name is a property key that is a String value.

An integer index is a String-valued property key that is a canonical numeric String and whose numeric value is either +0 or a positive integer <= 2^53-1. An array index is an integer index whose numeric value i is in the range +0 <= i < 2^32-1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment