Upcoming changes in ECMAScript 6

Print Friendly

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

Let Statement
const Statement

New collections

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
  • 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/

ES Wiki: http://en.wikipedia.org/wiki/ECMAScript

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Comments

  1. […] Upcoming changes in ECMAScript 6 […]

http://www.windowsvj.com/outlet