Marta can quote one country’s postage. The courier’s booking form also needs the zone names, their count, and a rate sheet. You’ll extract those from her JavaScript rates object, then meet the lookup type that preserves number keys.
Extract the Zones and Rates
In Python, you’d use list(RATES), list(RATES.values()), and list(RATES.items()). JavaScript supplies Object.keys(), Object.values(), and Object.entries(). Each takes the object and returns an array. An entry is a [key, value] pair represented as an array rather than a Python tuple.
These functions include only own properties that are enumerable and have string keys. Own properties belong directly to the object, while enumerable ones appear in property listings. The ordinary properties in this object literal qualify.
These functions live on Object to stay out of the way of your own keys. Python distinguishes RATES.keys from RATES["keys"], but JavaScript reads the same property with either spelling. A zone called "keys" would hide a method stored there. Watch out for RATES.items(): it raises a TypeError, so use Object.entries(RATES) instead.