Object Keys and Values
Keys Values
π¨βπΌ We have a small inventory object and need to extract the names and
quantities for reporting.
π¨ Open
and use the provided
inventory fixture:- Create
itemNamesusingObject.keysβ expected order:['apples', 'oranges', 'bananas', 'mangoes'] - Create
quantitiesusingObject.valuesβ expected order:[12, 8, 0, 4] - Create
totalQuantityby summingquantities(expected24, including the0for bananas) - Export
itemNames,quantities, andtotalQuantity
- π MDN - Object.keys
- π MDN - Object.values