Destructuring 1b

by Pritesh Patel

JavaScript

const cart = [
  [ 'Hersheys Bar', '1.00', '504' ],
  [ 'Almonds', '5.00', '321'],
  [ 'Lotion', '2.50', '287' ]
]

const cartAsObjects = cart.map(([item, price, sku]) => ({item, price, sku}));