删除数组的某些元素

     let list = [
        { id: 1, age: 20, gender: '男', native: 'hangzhou', hobby: 'dance' },
        { id: 2, age: 20, gender: '女', native: 'hangzhou', hobby: 'dance' }
      ];
      // 删除属性gender和native
      for (let item of list) {
        delete item.gender;
        delete item.native;
      }
      console.log('list', list);
     // list , [{id: 1, age: 20, hobby: "dance"}1: {id: 2, age: 20, hobby: "dance"]

你可能感兴趣的:(删除数组的某些元素)