[js]ES6删除和过滤对象中部分属性
在向后端传参时有用
let student={
age: 20,
name: 'maomao',
sex: "男"
}
// func1:
const param = (({name,sex}) => ({name, sex}))(student)
console.log(param) // {name: "maomao",sex: "男"}
// func2:
let {age,...params} = student
console.log(params) // {name: "maomao",sex: "男"}