← Back to index

ECMAScript 6: New Features: Overview and Comparison

Created: 2015-11-19 03:21  |  Source: http://es6-features.org/#SymbolType

Fork me on GitHub

This page has been shared 1399 times. View these Tweets.

0
ES6
ECMAScript 6 — New Features: Overview & Comparison
See how cleaner and more concise
your JavaScript code can look and
start coding in ES6 now !!
"A good programming language is a
conceptual universe for thinking
about programming." — Alan J. Perlis
Symbol Type
Symbol Type
Unique and immutable data type to be used as an identifier for object properties. Symbol can have an optional description, but for debugging purposes only.
ECMAScript 6 — syntactic sugar: reduced | traditional
Symbol("foo") !== Symbol("foo") const foo = Symbol() const bar = Symbol() typeof foo === "symbol" typeof bar === "symbol" let obj = {} obj[foo] = "foo" obj[bar] = "bar" JSON.stringify(obj) // {} Object.keys(obj) // [] Object.getOwnPropertyNames(obj) // [] Object.getOwnPropertySymbols(obj) // [ foo, bar ]
ECMAScript 5 — syntactic sugar: reduced | traditional
// no equivalent in ES5
Copyright © 2015 Ralf S. Engelschall   @engelschall
Fully generated from a single source
Licensed under MIT License.