배열의 각 아이템으 별도 변수에 할당하는 문법
let sanArray = [1, 2, 3, 4,];
let [fist, second, third, forth] = sanArray;
let [data1, data2] = sanArray;
console.log(data1, data2);
let sanArray2 = ["SanE", "dannysir", "SeoSan"];
let [value1, value2] = sanArray;
console.log(value1, value2);
let myArray = ["SanE", "danny", "SeoSan", "Alex", "Andy"];
let [item1, item2, ... item3] = myArray;
console.log(item1);
console.log(item2);
console.log(item3);
SanE
dannysir
Andy
let myArray1 = [10, 20];
let [item1, item2= 10, item3 = 20] = myArray1;
console.log(item1, item2, item3);
let a = 1;
let b = 2;
[a, b] = [b, a];
console.log(a, b);
function getData(){
return [10, 20];
}
let [a, b] = getData();
console.log(a, b);
let data = "Seoul yangchon,mockdong"
console.log(data.split(''));
console.log(data.split(','));
let data = "Seo San"
let [firstName, lastName] = data.split(' ');
console.log(firstName,lastName);