Skip to content

ES6+ Features List

This lesson explains ES6+ Features List with clear examples, use cases, and best practices so you can use modern JavaScript confidently in real projects.

ES6 Features List Overview

ES6, also called ECMAScript 2015, introduced many important JavaScript features that changed how modern applications are written. These features improve readability, modularity, asynchronous programming, object-oriented programming, data handling, and developer productivity.

This list view covers the most important ES6 features with short explanations and practical examples for frontend, backend, React, Node.js, and full-stack development.

ES6 Features List with Examples

  • 1. let Keyword
    let creates block-scoped variables that can be reassigned. It is safer than var for changing values.
    let count =
      1;
    
    count =
      2;
    
    console.log(count);
  • 2. const Keyword
    const creates block-scoped variables that cannot be reassigned. Use it by default for values that should not change.
    const appName =
      "Dashboard";
    
    console.log(appName);
  • 3. Block Scope
    Variables declared with let and const are available only inside the nearest block.
    if (true) {
      const message =
        "Inside block";
    
      console.log(message);
    }
  • 4. Arrow Functions
    Arrow functions provide shorter syntax and inherit this from the surrounding scope.
    const add =
      (a, b) => a + b;
    
    console.log(
      add(10, 20)
    );
  • 5. Template Literals
    Template literals use backticks and allow string interpolation.
    const name =
      "Alice";
    
    const message =
      `Welcome ${name}`;
    
    console.log(message);
  • 6. Multi-line Strings
    Template literals make multi-line strings easier to write.
    const text =
    `Line one
    Line two
    Line three`;
    
    console.log(text);
  • 7. Default Parameters
    Default parameters provide fallback values when arguments are missing or undefined.
    function greet(
      name = "Guest"
    ) {
      return "Hello " + name;
    }
    
    console.log(
      greet()
    );
  • 8. Rest Parameters
    Rest parameters collect remaining function arguments into an array.
    function sum(
      ...numbers
    ) {
      return numbers.reduce(
        (total, number) => total + number,
        0
      );
    }
    
    console.log(
      sum(1, 2, 3)
    );
  • 9. Spread Operator with Arrays
    Spread syntax copies or combines arrays.
    const frontend =
      ["HTML", "CSS"];
    
    const skills =
      [
        ...frontend,
        "JavaScript"
      ];
    
    console.log(skills);
  • 10. Spread Operator with Objects
    Object spread creates shallow copies and updates objects immutably.
    const user =
      {
        name: "John",
        active: true
      };
    
    const updatedUser =
      {
        ...user,
        active: false
      };
    
    console.log(updatedUser);
  • 11. Array Destructuring
    Array destructuring extracts values by position.
    const colors =
      ["Red", "Green", "Blue"];
    
    const
    [
      first,
      second
    ]
    =
    colors;
    
    console.log(first);
    console.log(second);
  • 12. Object Destructuring
    Object destructuring extracts values by property name.
    const user =
      {
        name: "Alice",
        city: "Dallas"
      };
    
    const
    {
      name,
      city
    }
    =
    user;
    
    console.log(name);
    console.log(city);
  • 13. Destructuring with Default Values
    Destructuring can provide fallback values for missing properties.
    const settings =
      {
        theme: "dark"
      };
    
    const
    {
      theme,
      language = "en"
    }
    =
    settings;
    
    console.log(language);
  • 14. Destructuring Function Parameters
    Function parameters can directly destructure object values.
    function displayUser(
      {
        name,
        role
      }
    ) {
      console.log(name);
      console.log(role);
    }
    
    displayUser(
      {
        name: "Sarah",
        role: "Admin"
      }
    );
  • 15. Enhanced Object Literals
    ES6 allows property shorthand when variable names match property names.
    const name =
      "David";
    
    const role =
      "Editor";
    
    const user =
      {
        name,
        role
      };
    
    console.log(user);
  • 16. Concise Object Methods
    Object methods can be written without the function keyword.
    const calculator =
      {
        add(a, b) {
          return a + b;
        }
      };
    
    console.log(
      calculator.add(2, 3)
    );
  • 17. Computed Property Names
    Object keys can be created dynamically using square brackets.
    const field =
      "email";
    
    const user =
      {
        [field]:
          "user@example.com"
      };
    
    console.log(user.email);
  • 18. Classes
    Classes provide cleaner syntax for creating reusable objects.
    class User {
      constructor(name) {
        this.name =
          name;
      }
    
      greet() {
        return "Hello " + this.name;
      }
    }
    
    const user =
      new User("Alice");
    
    console.log(
      user.greet()
    );
  • 19. Class Inheritance
    The extends keyword creates child classes.
    class User {
      login() {
        return "Logged in";
      }
    }
    
    class Admin extends User {
      deleteUser() {
        return "Deleted user";
      }
    }
    
    const admin =
      new Admin();
    
    console.log(
      admin.login()
    );
  • 20. super Keyword
    The super keyword calls the parent class constructor or parent methods.
    class User {
      constructor(name) {
        this.name =
          name;
      }
    }
    
    class Admin extends User {
      constructor(name, role) {
        super(name);
    
        this.role =
          role;
      }
    }
  • 21. ES Modules
    Modules allow JavaScript files to export and import reusable code.
    // math.js
    
    export function add(a, b) {
      return a + b;
    }
    
    // app.js
    
    import
    {
      add
    }
    from "./math.js";
  • 22. Default Exports
    A module can export one primary value as default.
    // User.js
    
    export default class User {}
    
    // app.js
    
    import User
    from "./User.js";
  • 23. Named Exports
    Named exports allow multiple exports from one module.
    export const API_URL =
      "/api";
    
    export function formatDate() {
      return "Today";
    }
  • 24. Promises
    Promises represent future success or failure of asynchronous work.
    const promise =
      Promise.resolve("Success");
    
    promise.then((value) => {
      console.log(value);
    });
  • 25. Promise Chaining
    Promises can be chained for step-by-step asynchronous workflows.
    fetch("/api/users")
      .then((response) => response.json())
      .then((users) => {
        console.log(users);
      })
      .catch((error) => {
        console.error(error);
      });
  • 26. Map Collection
    Map stores key-value pairs and supports any value as a key.
    const userMap =
      new Map();
    
    userMap.set(
      "name",
      "Alice"
    );
    
    console.log(
      userMap.get("name")
    );
  • 27. Set Collection
    Set stores unique values.
    const uniqueTags =
      new Set(
        ["js", "css", "js"]
      );
    
    console.log(
      uniqueTags
    );
  • 28. WeakMap
    WeakMap stores object keys weakly and is useful for private object metadata.
    const privateData =
      new WeakMap();
    
    const user =
      {
        name: "Alice"
      };
    
    privateData.set(
      user,
      {
        token: "abc"
      }
    );
  • 29. WeakSet
    WeakSet stores weak references to objects only.
    const visited =
      new WeakSet();
    
    const node =
      {
        id: 1
      };
    
    visited.add(node);
    
    console.log(
      visited.has(node)
    );
  • 30. Symbol
    Symbol creates unique identifiers.
    const id =
      Symbol("id");
    
    const user =
      {
        [id]: 101,
        name: "John"
      };
  • 31. for...of Loop
    The for...of loop iterates over iterable values.
    const skills =
      ["HTML", "CSS", "JS"];
    
    for (const skill of skills) {
      console.log(skill);
    }
  • 32. Iterators
    Iterators provide a standard way to access values one at a time.
    const values =
      ["A", "B"];
    
    const iterator =
      values[Symbol.iterator]();
    
    console.log(
      iterator.next()
    );
  • 33. Generators
    Generator functions can pause and resume using yield.
    function* numbers() {
      yield 1;
      yield 2;
      yield 3;
    }
    
    const generator =
      numbers();
    
    console.log(
      generator.next()
    );
  • 34. Array.from()
    Converts array-like or iterable values into real arrays.
    const buttons =
      document.querySelectorAll("button");
    
    const buttonArray =
      Array.from(buttons);
    
    console.log(buttonArray);
  • 35. Array.of()
    Creates an array from provided values.
    const values =
      Array.of(
        1,
        2,
        3
      );
    
    console.log(values);
  • 36. Array.find()
    Finds the first item matching a condition.
    const users =
      [
        {
          id: 1,
          name: "Alice"
        },
        {
          id: 2,
          name: "Bob"
        }
      ];
    
    const user =
      users.find(
        (item) => item.id === 2
      );
    
    console.log(user);
  • 37. Array.findIndex()
    Finds the index of the first matching item.
    const index =
      users.findIndex(
        (item) => item.id === 2
      );
    
    console.log(index);
  • 38. String.includes()
    Checks whether a string contains another string.
    const message =
      "Learn JavaScript";
    
    console.log(
      message.includes("Script")
    );
  • 39. String.startsWith()
    Checks whether a string starts with specific text.
    const file =
      "index.html";
    
    console.log(
      file.startsWith("index")
    );
  • 40. String.endsWith()
    Checks whether a string ends with specific text.
    const file =
      "style.css";
    
    console.log(
      file.endsWith(".css")
    );
  • 41. String.repeat()
    Repeats a string a specified number of times.
    const line =
      "-".repeat(10);
    
    console.log(line);
  • 42. Object.assign()
    Copies properties from one or more objects into a target object.
    const target =
      {
        active: true
      };
    
    const source =
      {
        role: "Admin"
      };
    
    const result =
      Object.assign(
        target,
        source
      );
    
    console.log(result);
  • 43. Object.is()
    Compares two values more precisely than strict equality in special cases.
    console.log(
      Object.is(
        NaN,
        NaN
      )
    );
  • 44. Number.isNaN()
    Checks whether a value is exactly NaN.
    console.log(
      Number.isNaN(NaN)
    );
    
    console.log(
      Number.isNaN("Hello")
    );
  • 45. Number.isInteger()
    Checks whether a value is an integer.
    console.log(
      Number.isInteger(10)
    );
    
    console.log(
      Number.isInteger(10.5)
    );
  • 46. Number.isFinite()
    Checks whether a value is a finite number.
    console.log(
      Number.isFinite(100)
    );
    
    console.log(
      Number.isFinite(Infinity)
    );
  • 47. Number.parseInt()
    Parses a string into an integer.
    const value =
      Number.parseInt(
        "100px",
        10
      );
    
    console.log(value);
  • 48. Number.parseFloat()
    Parses a string into a floating-point number.
    const value =
      Number.parseFloat(
        "10.75"
      );
    
    console.log(value);
  • 49. Promise.all()
    Runs multiple Promises in parallel and waits for all to resolve.
    const results =
      await Promise.all(
        [
          fetch("/api/users"),
          fetch("/api/products")
        ]
      );
    
    console.log(results);
  • 50. Modules with type="module"
    Browser scripts can use ES Modules by adding type="module".
    <script
      type="module"
      src="/src/app.js">
    </script>

ES6 Features Summary

  • Variables: let, const, and block scope make variable handling safer.
  • Functions: Arrow functions, default parameters, and rest parameters make functions shorter and more flexible.
  • Objects: Destructuring, shorthand properties, computed keys, classes, and spread syntax improve object handling.
  • Arrays: Array.from(), Array.of(), find(), and findIndex() improve array workflows.
  • Async: Promises and Promise.all() improve asynchronous JavaScript.
  • Modules: export and import make JavaScript applications modular and scalable.

Common ES6 Feature Use Cases

  • React component development.
  • Node.js service modules.
  • Frontend application architecture.
  • API data transformation.
  • Reusable utility libraries.
  • Design system packages.
  • Dashboard applications.
  • Form validation.
  • State management.
  • Modern interview preparation.

ES6 Feature Best Practices

  • Use const by default.
  • Use let only when reassignment is needed.
  • Avoid var in modern JavaScript.
  • Use arrow functions for callbacks.
  • Use normal methods when object this is required.
  • Use destructuring only when it improves readability.
  • Use modules instead of global variables.
  • Use Promises for asynchronous workflows.
  • Prefer immutable object and array updates.
  • Check browser support for production projects.

ES6 Features Interview Questions

  • What are the most important ES6 features?
  • What is the difference between let, const, and var?
  • How do arrow functions differ from regular functions?
  • What is destructuring?
  • What are default parameters?
  • What is the spread operator?
  • What is the rest parameter?
  • What are ES Modules?
  • What is the difference between Map and Object?
  • How do Promises improve asynchronous code?

Pro Tip

For interviews, group ES6 features by purpose: variables (let, const), functions (arrow, default, rest), objects (destructuring, spread, classes), modules (import, export), collections (Map, Set), and async work (Promise, Promise.all()).