Destructuring
Easily extract array elements or objects properties store them in variables - Array Destructuring [a, b] = ['Hello', 'Max]; conosle.log(a); //Hello console.log(b); //Max const numbers = [1, 2, 3]; [num1, num2] = numbers; console.log(num1, num2); //1, 2 [num1, , num3] = numbers; console.log(num1, num3)l //1, 3 - Object Destructuring {name} = {name:'Max', age:28}; console.log(name) // Max console...
Spread & Rest Operator
spread operator -used to split up array elements or object properties const newArr = [...oldArr, 1, 2]; const newObj = {...oldObj, newProp: 5}; const numArr1 = [1, 2, 3]; const numArr2 = [...numArr1, 4, 5, 6]; console.log(numArr2); //[1, 2, 3, 4, 5, 6]; const numArr3 = [numArr1, 4, 5, 6]; console.log(numArr3); //[[1, 2, 3], 4, 5, 6]; const person = { name: 'Max' }; const newPerson = { ...person,..