1

My question may be stupid but I would like to be able to reduce the map function in one single line.

const data = [
  { a: 2, b: 8, c:9 },
  { a: 4, b: 0, c:5 },
];

data.map(obj => { 
  const {a, b} = obj 
  return {a, b};
});

I instinctively try this solution.

data.map(obj => { return {a, b} = obj });

Can you tell me why this solution does not work on Chrome ? Thanks you, Jonathan Giamporcaro

areuseriouus.eth
  • 383
  • 2
  • 3
  • 16

0 Answers0