ECMAScript is a standard that scripting languages like JavaScript and ActionScript are based on. ECMAScript is owned by ECMA International which owns other number of standards like ECMAScript intern and JSON too. At one of the sessions today during MVP Summit, the speaker discussed about ECMAScript 6 and changes in programming constructs being added to it.
ECMA 6 allows the following constructs:
Let and Const
- let is the new var
- const is read only let
- let/const can replace var
- Semantics
- Block scoped
- No use before declaration
- Const cant be reassigned
New collections
- Set
Like an array, but no duplicates and O(1) add/remove/has - Map
Map any object or primitive to any other object or primitive in O(1) complexity
http://tc39wiki.calculist.org/es6/map-set/
- WeakMap
Can only map objects to other objects
Holds keys and objects weekly
http://tc39wiki.calculist.org/es6/weak-map/
Internationalization in ECMA 6
- Huge Unicode data tables
- Culture sensitive string sorting, number/date formatting
- Adds native JavaScript support for
- 364 locales
- 18 numbering systems
- Data patterns
- Calendaring systems: gregorian/islamic/hebrew etc
ES6 upcoming features
- Classes in JavaScript
- Allows for declaring static and non-static methods and super calls
http://tc39wiki.calculist.org/es6/classes/
- Allows for declaring static and non-static methods and super calls
- New function signatures
- Arrow function -terse
- Default paramaeters – if no parameter, use default value is used
- Rest parameters – bind any trailing parameters to an actual array
- Iterators
- Call a.next() until end
- New looping constructs
- Generators
- Function can yield many times before returning
To test let construct, you may use following script:
<script> var i =5; alert(i); let j = 10; alert(j); </script>
This will run perfectly fine on IE11, for Chrome go to chrome://flags and enable experimental Javascript, Firefox try nightly build to test the new features.
More Code examples to follow.
TC39 drafts: http://tc39wiki.calculist.org/





















[…] Upcoming changes in ECMAScript 6 […]