Error --> Extra Credit: should return common characters between more than two strings
({a, b, ...rest} = {a: 10, b: 20, c: 30, d: 40});
console.log(a); // 10
console.log(b); // 20
console.log(rest); // {c: 30, d: 40}
{...}
var x = [1, 2, 3, 4, 5];
var [y, z] = x;
console.log(y); // 1
console.log(z); // 2
// ๋ณ์์ ๊ธฐ๋ณธ๊ฐ์ ํ ๋นํ๋ฉด, ๋ถํดํ ๊ฐ์ด undefined์ผ ๋ ๊ทธ ๊ฐ์ ๋์ ์ฌ์ฉ
var a, b;
[a=5, b=7] = [1];
console.log(a); // 1
console.log(b); // 7
function sum(x, y, z) {
return x + y + z;
}
const numbers = [1, 2, 3];
console.log(sum(...numbers));
// expected output: 6
console.log(sum.apply(null, numbers));
// expected output: 6
// ๋ฐฐ์ด์ ์ฐ๊ฒฐํ๋ ๋ฐฉ๋ฒ
var arr1 = [0, 1, 2];
var arr2 = [3, 4, 5]; // arr2 ์ ๋ชจ๋ ํญ๋ชฉ์ arr1 ์ ๋ถ์
arr1 = arr1.concat(arr2);
// ์ ๊ฐ๊ตฌ๋ฌธ ์ฌ์ฉ
var arr1 = [0, 1, 2];
var arr2 = [3, 4, 5];
arr1 = [...arr1, ...arr2]; // arr1 ์ ์ด์ [0, 1, 2, 3, 4, 5]