(1)交换变量的值
[x, y] = [y, x];
(2)提取JSON数据
var jsonData = {
id: 42,
status: "OK",
data: [867, 5309]
};
let { id, status, data: number } = jsonData;
console.log(id, status, number);
2024-04-11 16:51:25
(1)交换变量的值
[x, y] = [y, x];
(2)提取JSON数据
var jsonData = {
id: 42,
status: "OK",
data: [867, 5309]
};
let { id, status, data: number } = jsonData;
console.log(id, status, number);