Talia Bale

HTML5, CSS3 and Design.

the future of JavaScript is here! “Approved for ECMAScript 6”

Super excited about the features coming in ES6 (see Brendan Eich slides). And you know what? Most of these features already work in Firefox. Just use JavaScript 1.8, and enjoy!

<script type="application/javascript;version=1.8">
  • let (MDN doc)
  • const(MDN doc)
  • destructuring (MDN doc):
    let {x, y} = {12, 13};
    let  [s, v, o] = [2, 7, 8];
  • proxies (MDN doc), weak maps (MDN doc):
    Proxy.create(handler, proto), new WeakMap
  • modules:
    module M { export function fast_sin(x) {…} }
  • iterators, generators (MDN doc):
    function* gen() { yield 1; yield 2; }
  • Array comprehensions (MDN doc):
    return [a+b for a of A for b of B]
  • parameter default values:
    function f(x, y=1, z=0) {…}
    
  • rest, spread:
    function g(i, j, …r) {
      return r.slice(i, j);
    }
    let a = [0,1,2,3],
        o = new any_constructor(…a);

More info on the Mozilla Developer Network (look at JavaScript 1.7, 1.8 and 1.8.5).

  1. gorczycajexp593398 reblogged this from taliabale
  2. edanhewitt reblogged this from taliabale
  3. psdtohtmlshop reblogged this from taliabale
  4. taliabale posted this