Last active
June 19, 2020 05:39
-
-
Save geomago/e8a6e1471d8cde3b71de6f595de73a17 to your computer and use it in GitHub Desktop.
find_cars
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let maxPrice = cars.reduce( (prevPrice, current) => prevPrice < current.price ? current.price : prevPrice, 0); | |
| let priceyCars = cars.filter( (car) => car.price==maxPrice ); | |
| // RESULT IS: | |
| [{ | |
| id: 4, | |
| make: "Bugatti", | |
| model: "Chiron Pur Sport", | |
| price: 3000000, | |
| colour: "blue" | |
| }, { | |
| id: 8, | |
| make: "Bugatti", | |
| model: "Chiron Pur Sport", | |
| price: 3000000, | |
| colour: "red" | |
| }] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment