Object Entries and fromEntries

Entries from Entries
πŸ‘¨β€πŸ’Ό We need to apply a discount to all prices in our catalog and return a new object with updated values.
🐨 Open
index.ts
and use the provided priceBySku fixture:
  1. Create entries using Object.entries β€” expected: [['sku-1', 1299], ['sku-2', 499], ['sku-3', 2500]]
  2. Create discountedEntries by transforming each entry's price to 10% off, rounded to the nearest whole number. Expected discounted prices: 1169, 449, and 2250 (same sku order)
  3. Create discountedPrices using Object.fromEntries β€” expected: { 'sku-1': 1169, 'sku-2': 449, 'sku-3': 2250 }
  4. Export entries, discountedEntries, and discountedPrices

Please set the playground first

Loading "Object Entries and fromEntries"
Loading "Object Entries and fromEntries"