解构赋值
let [arr, str, obj] = [
[2, 4, 6], "hello word", { city: "beijing", address: "北三环" }
]
console.log(arr);
console.log(str);
console.log(obj);
let [
[num1, num2, num3], str, { city }
] = [
[2, 4, 6], "hello word", { city: "beijing", address: "北三环" }
]
console.log(num3);
console.log(str);
console.log(city);
let [
[, , num3], str, { city }
] = [
[2, 4, 6], "hello word", { city: "beijing", address: "北三环" }
]
console.log(num3);
console.log(str);
console.log(city);
function ajax({
url = new Error(),
method = "get",
data = {}
}) {
console.log(method);
}
ajax({
url: "",
method: "post"
});