Stuck on Problem 94, checking an array for the object with the highest price that returns the entire object with that highest price book

I need to return the object but also the object with the highest price,
i need to return the entire object with the highest price book.

Can someone check my work

Instead of keeping track of currentPrice, it’d be better to keep track of a current book, and compare its price on each iteration.

The current book could be setup with either a fake book, as suggested in the notes, or it could start with the first (or any) book in the array.

Good luck! :slight_smile:

1 Like