Chrome (dev) implements future JavaScript features

    The ECMA committee is currently working on the development of the next version of JavaScript, code-named Harmony . It should be completed by the end of next year and will be the biggest update in the history of the language. Chrome and V8 developers have already decided to implement some future JavaScript functions in the Chrome browser ( version for developers ).

    In order to activate new features, in the latest release from the dev channel, type chrome://flagsand enable the Experimental JavaScript features flag .

    • Lexical scope . Now let- this is a new one var. Standard declarations are varsupplemented letand const. Both are the correct ways to assign values ​​to objects in which the scope extends within the block, which eliminates the typical source of errors and strange behavior. Declaration of functions is now officially possible in the local scope, while lexical scope is allowed (lexical scope is possible only in strict mode).
    • Collections . Effective sets and associative arrays. Any element can be used as a key or value, including objects.
    • Weak maps . A special kind of associative array for which the garbage collector determines when the key is no longer available, so the key-value pair can be automatically removed from the associative array.
    • Proxy object . A proxy simulates a JavaScript object or function and allows you to customize almost any aspect of your behavior. The developers believe that this is a really powerful thing that takes reflection (reflection) to a new level and can be used for various advanced abstractions and interfaces .
    ... and much more will come later.

    via The Chromium Blog

    Also popular now: