ES61 24Dec2019 TIL Today I learned : ES6 (Destructing Assignment / Spread Operators / Rest Operators / Default Parameters) Destructing Assignment let user = { name : 'monkey', age : 30 }; function greeting ({name, age}) { console.log(`hi ${name}! Your age is ${age}`); }; greeting(user); // 'hi monkey! Your age is 30' Spread Operators let sum = (a, b, c, d) => a+b+c+d; let arr = [1, 2, 3, 4]; sum(...arr);// 10 Rest.. 2019. 12. 24. 이전 1 다음