This question has already been answered:

Hello There is for example an array `

testArray = [ { name: 'Salmon - Canned', price: '$91.56', }, { name: 'Soup - Beef, Base Mix', price: '$126.14', }, { name: 'Soup - Beef, Base Mix3', price: '$126.14', }, { name: 'Soup - Beef, Base Mix2', price: '$126.14', }, ]; 

And I need to get an array in which there will be no "price" field. Like this:

  testArray = [ { name: 'Salmon - Canned', }, { name: 'Soup - Beef, Base Mix', }, { name: 'Soup - Beef, Base Mix3', }, { name: 'Soup - Beef, Base Mix2', }, ]; 

How to do it?

Reported as a duplicate at Grundy. javascript Aug 19 '18 at 4:25 pm

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

    1 answer 1

    So?

     let testArray = [ { name: 'Salmon - Canned', price: '$91.56', }, { name: 'Soup - Beef, Base Mix', price: '$126.14', }, { name: 'Soup - Beef, Base Mix3', price: '$126.14', }, { name: 'Soup - Beef, Base Mix2', price: '$126.14', }, ]; testArray = testArray.map(e => Object.create({name: e.name})); console.log(testArray);