All Articles

Learning ES6 Syntax

javascript.svg

Good References:

Destructuring assignment

const [a, b] = [10, 20];

Template literals

const a = 5; 
const b = 10;
console.log(`Fifteen is ${a + b}`

Spread syntax Works with objects, clones

...array/object

Object bracket notation

object.property
object['property']

Optional chaining

const adventurer = {
  name: 'Alice',
  cat: {
    name: 'Dinah'
  }
};

const dogName = adventurer.dog?.name;