Professional Documents
Culture Documents
CHEAT SHEET 01
Copy an object with spread
const newObject = {. . .oldObject1, . . .oldObject2};
Embed variables
Default values
const name = “Captain America”;
const scores = [22 , 23];
`Hello my name is ` ${name} ;
const [Java = 50 , JS = 50 , CPP = 50] = scores;
Embed expression
Destructuring function arguments
const isRaining = true ;
function greet({ firstname, lastname}) {
`Hey is it raining? ${isRaining ? “Yes it’s
console.log(’${firstname}${lastname}!’)
raining” : “Nope”} ;
}