← Back to challenges

Pricey Products

JavaScriptHardobjectsdata_structuresarrayssorting

Instructions

You will be given an object with various consumer products and their respective prices. Return a list of the products with a minimum price of 500 in descending order.

Examples

products({"Computer" : 600, "TV" : 800, "Radio" : 50}) ➞ ["TV","Computer"]

products({"Bike1" : 510, "Bike2" : 401, "Bike3" : 501}) ➞ ["Bike1", "Bike3"])

products({"Loafers" : 50, "Vans" : 10, "Crocs" : 20}) ➞ []

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.