Answers for "map object and destructure javascript"

0

array map destructuring

var arr = [
  { name: "Anuja", from: "Saurav" },
  { name: "Saurav", from: "Anuja" },
  { name: "All", from: "All" },
];

arr.map(({ name, from }) => console.log(name, from));
Posted by: Guest on June-11-2020
0

object destructuring example

const hero = {
  name: 'Batman',
  realName: 'Bruce Wayne',
  address: {
    city: 'Gotham'
  }
};

// Object destructuring:
const { realName, address: { city } } = hero;
city; // => 'Gotham'
Posted by: Guest on February-18-2021

Code answers related to "map object and destructure javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language