Auction.com Interview Question

solving a problem using javascript