Notes: A Gentle Introduction to ES6

  • http://kangax.github.io/compat-table/es6/

  • var => keywords let and const to help prevent unnecessary errors

    • var can be reassigned and redeclared
    • let can be reassigned but not redeclared
    • const cannot be reassigned or redeclared
    • const is not hoisted

  • Function Scoping => Function Scoping + Block Scoping

    • var can only be function scoped
    • let and const are block scoped

  • Template Literals

    • string concatenation => string interpolation
    • explicit line breaks in a string => multi-line strings

  • Default Values

  • Anonymous functions => Arrow Functions

    • arrow functions keep context

  • Destructuring

    • arrays, objects, nested objects, renaming

  • pass individual parameters to a function => rest parameters

  • concat => spread operator

  • forEach => for..of

  • constructors => classes

To learn more, see our resource list for JavaScript for WordPress developers

Leave a comment