Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 544 Bytes

cheapest-book.md

File metadata and controls

23 lines (17 loc) · 544 Bytes

Cheapest Book

Given an array of book objects, return the book object with the cheapest price. eg.

function findCheapest(books){
// write your code here
}
let listOfBookObj = [
    {title:'Fox In Socks', price:32.20},
    {title:'The Cat In The Hat', price:16.20},
    {title:'Green Eggs and Ham', price:52.50},
    {title:'Thinking Fast and Slow', price:28.80},
    {title:'War and Peace', price: 5.20}
];
console.log(findCheapest(listOfBookObj));

should return the {title:'War and Peace', price: 5.20}, in the input list.