프론트엔드 공부/javscript

배열구조분해할당(destructing)

maggieH 2021. 4. 29. 22:25

let numbers=[10,22,33];
let [one, two,three,six = 80] = numbers;
console.log(three);//33
console.log(six);//80 default value
function bottle(){
  return ['bottle','water'];
}

let[red,blue] = bottle();
console.log(red);//bottole