JavaScript - ES6

November 12, 2023


ES6 - What's New?

  1. Arrow Functions
  2. Template Literals
    Hello `${name}!`
  3. Destructuring Assignment
    const [a, b] = [1, 2];
    const { x, y } = { x: 10, y : 20 };
  4. Let and Const
  5. Default Parameters
    function example (param = defaultValue) {
        // function body
    }
  6. Rest Parameters
    function exampleFunction(...args)
  7. Spread Operator
    const newArray = [...oldArray];
    const newObj = { ...oldObj };
  8. Classes
    class MyClass {
        constructor() {
    
        }
    }
  9. Modules
    export const myVariable = 42;
    import { myVariable } from "./otherModule";
  10. Promises
    const myPromise = new Promise((resolve, reject)) => {
        // asynchrounous code
    }

Profile picture

Written by Sudhansu Gouda who lives and works in Bengaluru building useful things. You should connect with him on LinkedIn