解构数组 解构数组元素 let input = [1, 2]; let [first, second] = input; console.log(first,second); 交换值 [first, second] = [second, first]; 函数参数解构 function f([first, second]: [number, number]){ console.log(first,second); } f([1,2]); 剩余变量 let [first, ...rest] = [1