First-Class Functions Practice Lab
Objectives
Practice using forEach
Practice using sort
Practice using reduce
Instructions
Be sure to run the tests to get a feel for the types of problems this lab is asking you to solve.
You'll be writing six functions:
logDriverNames()— Receives an array ofdriverobjects and logs thenameattribute of eachdriverto the console.logDriversByHometown()— Receives an array ofdriverobjects as the first argument and a location as the second argument. The function logs to the console thenameattribute of eachdriverwhose hometown matches the string passed in as the 'location' argument.driversByRevenue()— Receives an array ofdriverobjects and returns a new array ofdriverobjects sorted by theirrevenueattribute from lowest to highest.driversByName()— Receives an array ofdriverobjects and returns a new array ofdriverobjects sorted by theirnameattribute from A to Z. Here, you may have to use theString.prototype.localeCompare()method.totalRevenue()— Receives an array ofdriverobjects and returns the sum of the revenue earned by each driver.averageRevenue()— Receives an array ofdriverobjects and returns the average revenue earned by each driver.
Resources
Clone: https://github.com/learn-co-curriculum/js-advanced-first-class-functions-practice-lab
Last updated