方法一:使用delete关键字
// 定义JSON对象
var obj = {name: "Alice", age: 25, city: "Beijing"};
// 移除属性
delete obj.age;
console.log(obj); // 输出: {name: "Alice", city: "Beijing"}
方法二:使用ES6的解构赋值
// 定义JSON对象
var obj = {name: "Alice", age: 25, city: "Beijing"};
// 解构赋值移除属性
var {age, ...newObj} = obj;
console.log(newObj); // 输出: {name: "Alice", city: "Beijing"}