JavaScript
  • JavaScript Introduction
  • JS Engine
  • V8 Engine
  • First-class function
  • Optimized Code
  • Call Stack & Memory heap
  • Single Thread
  • JavaScript RunTime
  • Nodejs
  • Context and Environment
  • Hoisting
  • Functions
  • Arguments
  • Variables
  • Scope
  • IIFE
  • this
  • call(), apply() and bind()
  • currying
  • Types
  • Type Coercion
  • Functions as Object
  • HOF (Higher Order Function)
  • Two pillars of Javascript
  • Closures
  • Prototypal Inheritance
  • OOP and FP
  • OOP
    • 4 principles of OOP
  • FP
    • Pure function
    • Imperative vs Declarative
    • Immutability
    • HOF and Closures
    • Currying
    • Partial Application
    • Compose and Pipe
  • Composition vs Inheritance
  • OOP vs FP
  • JS working
  • Promises
  • Async Await
  • ES5 - ECMAScript 2009
  • ES6 - ECMAScript 2015
  • ES7 - ECMAScript 2016
  • ES8 - ECMAScript 2017
  • ES9 - ECMAScript 2018
  • ES10 - ECMAScript 2019
  • ES11 - ECMAScript 2020
  • ES12 - ECMAScript 2021
  • JOB Queue
  • Promises Execution
Powered by GitBook
On this page

Was this helpful?

ES9 - ECMAScript 2018

Object Spread:

EX:
const animals = {
    tigers: 23,
    lions: 10,
    monkeys: 5
};

const { tigers, ...rest } = animals;
console.log(tigers); // 23
console.log(rest); // { lions: 10, monkeys: 5 }

finally:

finally function in Promises.

EX:
const urls = [
    'https://jsonplaceholder.typicode.com/users',
    'https://jsonplaceholder.typicode.com/posts',
    'https://jsonplaceholder.typicode.com/albums'
];
Promise.all(urls.map(url => {
        fetch(url).then(res => res.json());
    }))
    .then(array => {
        console.log('users', array[0]);
        console.log('posts', array[1]);
        console.log('albums', array[2]);
    })
    .catch(console.log)
    finally(() => console.log('default value'));

for await of (Asynchronous Iteration):

With asynchronous iterables, we can use the await keyword in for/of loops.

EX:
async function example() {
   // Regular iterator
   for (const item of NumberIterator) {
      // …
   }
   // Async iterator
   for await (const item of AsyncNumberIterator) {
      // …
   }
}
PreviousES8 - ECMAScript 2017NextES10 - ECMAScript 2019

Last updated 4 years ago

Was this helpful?