Destructuring 1b
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}));
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}));