const arr = [
{
id: 1,
name: 'index',
params: [],
},
{
id: 2,
name: 'glossaryDetail',
params: ['id'],
},
{
id: 3,
name: 'wordQuestionDetail',
params: ['id'],
},
{
id: 4,
name: 'questionDetail',
params: ['id'],
},
]
const a = arr.map(item => {
delete item.params;
return item;
})
console.log(a);
const b = arr.map(item => ({ id, name } = item))
console.log(b);
const c = arr.map(item => {
const {id, name} = item;
return {id, name};
)
console.log(c);
[
{ id: 1, name: 'index' },
{ id: 2, name: 'glossaryDetail' },
{ id: 3, name: 'wordQuestionDetail' },
{ id: 4, name: 'questionDetail' }
]
[
{ id: 1, name: 'index' },
{ id: 2, name: 'glossaryDetail' },
{ id: 3, name: 'wordQuestionDetail' },
{ id: 4, name: 'questionDetail' }
]