SOURCE

let arr = [11, 22, 33]
let [a, , c] = arr
console.log(a, c)

let str = '1122334455'
let [str1,,,,,,str2] = str
console.log(str1, str2)

// let name = 'shinn lancelot'
// let obj = {}
// [obj.n1, obj.n2] = name.split(' ')
// console.log(obj)

// let aa = 'shinn'
// let bb = 'lancelot'
// [aa, bb] = [bb, aa]
// console.log(aa, bb)

let [name1, name2, ,,...rest] = [11, 22, 33, 44, 55, 66, 77, 88, 99]
console.log(rest)

let [aa, bb] = []
console.log(aa, bb)

let q, w, e
({q: qq, w, e} = {q: 1, w: 2, e: 3})
console.log(qq, w, e)


let options = {
  title: "My menu",
  items: ["Item1", "Item2"],
  width: 111
}

function showMenu({
  title = "Untitled",
  width: w = 100,
  height: h = 200,
  items: [item1, item2]
}) {
  console.log( `${title} ${w} ${h}` )
  console.log( item1 )
  console.log( item2 )
}

showMenu(options)
console 命令行工具 X clear

                    
>
console