mbeaudru/modern-js-cheatsheet: Cheatsheet for the JavaScript knowledge you will frequently encounter in modern projects.

PHOTO EMBED

Sun Jul 25 2021 22:11:43 GMT+0000 (Coordinated Universal Time)

Saved by @davidTheNerdy #basic

const myObj = { x: 1, y: 2, a: 3, b: 4 };
const { x, y, ...z } = myObj; // object destructuring here
console.log(x); // 1
console.log(y); // 2
console.log(z); // { a: 3, b: 4 }

// z is the rest of the object destructured: myObj object minus x and y properties destructured

const n = { x, y, ...z };
console.log(n); // { x: 1, y: 2, a: 3, b: 4 }

// Here z object properties are spread into n
content_copyCOPY

https://github.com/mbeaudru/modern-js-cheatsheet