- 1. The best support for ES6 out there
- 2. Supported ECMAScript 6 features
- 2.1. Arrows
- 2.2. Classes
- 2.3. Enhanced Object Literals
- 2.4. Template Strings
- 2.5. Destructuring
- 2.6. Default + Rest + Spread
- 2.7. Let + Const
- 2.8. Iterators + For..Of
- 2.9. Generators
- 2.10. Comprehensions
- 2.11. Unicode
- 2.12. Modules
- 2.13. Module Loaders
- 2.14. Map + Set + WeakMap + WeakSet
- 2.15. Proxies
- 2.16. Symbols
- 2.17. Subclassable Built-ins
- 2.18. Math + Number + String + Object APIs
- 2.19. Binary and Octal Literals
- 2.20. Promises
- 2.21. Reflect API
- 2.22. Tail Calls
The best support for ES6 out there
Using Babel, we provide the best support for ES6 on the market, in terms of variaty of availble language features.
Starting from Pagehop 1.3, you are be able to use features such as classes, modules, arrow functions, generators, iterators, for-of cycles and many others.
Supported ECMAScript 6 features
Arrows are a function shorthand using the
=> syntax. They are syntactically
similar to the related feature in C#, Java 8 and CoffeeScript. They support
both expression and statement bodies. Unlike functions, arrows share the same
this as their surrounding code.
ES6 classes are a simple sugar over the prototype-based OO pattern. Having a
single convenient declarative form makes class patterns easier to use, and
encourages interoperability. Classes support prototype-based inheritance, super
calls, instance and static methods and constructors.
Enhanced Object Literals
Object literals are extended to support setting the prototype at construction,
foo: foo assignments, defining methods and making super calls.
Together, these also bring object literals and class declarations closer
together, and let object-based design benefit from some of the same
Although most support the now standard property, some do not.
Template strings provide syntactic sugar for constructing strings. This is
similar to string interpolation features in Perl, Python and more. Optionally, a
tag can be added to allow the string construction to be customized, avoiding
injection attacks or constructing higher level data structures from string
Destructuring allows binding using pattern matching, with support for matching
arrays and objects. Destructuring is fail-soft, similar to standard object
undefined values when not found.
Default + Rest + Spread
Callee-evaluated default parameter values. Turn an array into consecutive
arguments in a function call. Bind trailing parameters to an array. Rest
replaces the need for
arguments and addresses common cases more directly.
Let + Const
Block-scoped binding constructs.
let is the new
single-assignment. Static restrictions prevent use before assignment.
Iterators + For..Of
Iterator objects enable custom iteration like CLR IEnumerable or Java
for..in to custom iterator-based iteration with
for..of. Don’t require realizing an array, enabling lazy design patterns like
Iteration is based on these duck-typed interfaces (using
TypeScript type syntax for exposition only):
Generators simplify iterator-authoring using
yield. A function
declared as function* returns a Generator instance. Generators are subtypes of
iterators which include additional
throw. These enable values to
flow back into the generator, so
yield is an expression form which returns a
value (or throws).
Note: Can also be used to enable ‘await’-like async programming, see also ES7
The generator interface is (using TypeScript type
syntax for exposition only):
Array and generator comprehensions provide simple declarative list processing
similar as used in many functional programming patterns.
Not available in Pagehop
Due to their experimental nature, these are only available if experimental support is enabled, which is not possible in Pagehop, at this moment.
Non-breaking additions to support full Unicode, including new unicode literal
form in strings and new RegExp
u mode to handle code points, as well as new
APIs to process strings at the 21bit code points level. These additions support
Language-level support for modules for component definition. Codifies patterns
defined by a host-defined default loader. Implicitly async model – no code
executes until requested modules are available and processed.
Some additional features include
export default and
Babel can transpile ES6 Modules to several different formats including Common.js, AMD, System, and UMD. You can even create your own. For more details see the modules docs on Babel’s website.
Module loaders support:
- Dynamic loading
- State isolation
- Global namespace isolation
- Compilation hooks
- Nested virtualization
The default module loader can be configured, and new loaders can be constructed
to evaluated and load code in isolated or constrained contexts.
Additional polyfill needed
Since babel defaults to using common.js modules, it does not include the polyfill for the module loader API. Get it here.
Using Module Loader
In order to use this, you’ll need to tell babel to use the
systemmodule formatter. Also be sure to check out System.js.
Map + Set + WeakMap + WeakSet
Efficient data structures for common algorithms. WeakMaps provides leak-free
object-key’d side tables.
Proxies enable creation of objects with the full range of behaviors available to
host objects. Can be used for interception, object virtualization,
There are traps available for all of the runtime-level meta-operations:
Symbols enable access control for object state. Symbols allow properties to be
keyed by either
string (as in ES5) or
symbol. Symbols are a new primitive
name parameter used in debugging - but is not part of identity.
Symbols are unique (like gensym), but not private since they are exposed via
reflection features like
In ES6, built-ins like
Date and DOM
Elements can be subclassed.
Math + Number + String + Object APIs
Many new library additions, including core Math libraries, Array conversion
helpers, and Object.assign for copying.
Limited support from polyfill
Most of these APIs are supported by the babel polyfill. However, certain features are omitted for various reasons (e.g.
String.prototype.normalizeneeds a lot of additional code to support). You can find more polyfills here.
Binary and Octal Literals
Two new numeric literal forms are added for binary (
b) and octal (
Only supports literal form
Babel is only able to transform
Promises are a library for asynchronous programming. Promises are a first class
representation of a value that may be made available in the future. Promises are
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.
Calls in tail-position are guaranteed to not grow the stack unboundedly. Makes
recursive algorithms safe in the face of unbounded inputs.
Currently only self referencing tail recursion is supported due to the complexity of supporting tail calls globally.