0

I have an array of objects, for example:

 myArray = [
    {id:1, Fname:'Parker',Lname:'Smith',email:'demo@gmail.com',phone:"1313",adress:"TEst"},
    {id:2, Fname:'Robet',Lname:'Leng',email:'demo@gmail.com',phone:"1313",adress:"TEst"},
    {id:3, Fname:'Asia',Lname:'Smith',email:'demo@gmail.com',phone:"1313",adress:"TEst"},
  ]

I want to Destructure it into

DestructuringArray = [
    {id:1, Fname:'Parker',Lname:'Smith',email:'demo@gmail.com',phone:"1313"},
    {id:2, Fname:'Robet',Lname:'Leng',email:'demo@gmail.com',phone:"1313"},
    {id:3, Fname:'Asia',Lname:'Smith',email:'demo@gmail.com',phone:"1313"},
  ]
Chris G
  • 1,598
  • 1
  • 6
  • 18
testINGHUb
  • 28
  • 5
  • `myArray.forEach((obj) => delete obj.adress)` – Joel Sep 30 '22 at 12:10
  • 1
    that doesn't work, the accepted answer from that question doesn't work for this particular case but it there is another answer that solves the issue like this one `const DestructuringArray = myArray.map(function(item) { delete item.adress; return item; });` – Chris G Sep 30 '22 at 12:19

0 Answers0