1. 数组是在页面定义,不是从api获取:
const arrayData= [{index: 0,is_required: true,name: "vmvdnksl",type: "LONG_TEXT"},{index: 1,is_required: true,name: "dsvnlk",type: "MULTIPLE_SELECTORS"}]; const result = arrayData.map(({type,index,...rest}) => ({...rest})); console.log(result);
2. 数组格式未知,是从api获取的数据
var arrayData = { 0: { index: 0, is_required: true, name: "vmvdnksl", type: "LONG_TEXT" }, 1: { index: 1, is_required: true, name: "dsvnlk", type: "MULTIPLE_SELECTORS" } }; for (let key in arrayData) { delete arrayData[key].index; delete arrayData[key].type; } console.log(arrayData);