An exercise in problem solving in the functional idiom.
-
If you haven't release your lodown library to
npm
(node package manager), follow the steps in this video to do so:
- Run
os install
to installLets Get Functional
- Copy the name of your
lodown
package. It should be something likelodown-oliviasaborush
- In your bash terminal run the command
npm install --global lodown-oliviasaborush
with your lodown package - In your bash terminal run the command
npm link lodown-oliviasaborush
with your lodown package- These commands will not work unless you use your lodown name
- Open
index.js
- Update line 6 of
index.js
to reference yourlodown
library - It should look something like this:
const _ = require('lodown-oliviasaborush');
- Implement the functions outlined below, using your
lodown
library - Code and test your solutions in
index.js
- Data is available to you in an Array stored in the variable
customers
- To test your solutions run
npm start --prefix ./<YOUR_GITHUB_FOLDER/projects/let-s-get-functional
in your terminal
IMPORTANT: Make sure you replace <YOUR_GITHUB_FOLDER
with your actual github folder in your workspace.
- Objective: Find the number of male customers
- Input:
Array
- Output:
Number
- Constraints: use
filter
- Objective: Find the number of female customers
- Input:
Array
- Output:
Number
- Constraints: use
reduce
- Objective: Find the oldest customer's name
- Input:
Array
- Output:
String
- Constraints:
- Objective: Find the youngest customer's name
- Input:
Array
- Output:
String
- Constraints:
- Objective: Find the average balance of all customers
- Input:
Array
- Output:
Number
- Constraints:
- Objective: Find how many customer's names begin with a given letter
- Input:
Array
,Letter
- Output:
Number
- Constraints:
- Objective: Find how many friends of a given customer have names that start with a given letter
- Input:
Array
,Customer
,Letter
- Output:
Number
- Constraints:
- Objective: Find the customers' names that have a given customer's name in their friends list
- Input:
Array
,Name
- Output:
Array
- Constraints:
- Objective: Find the three most common tags among all customers' associated tags
- Input:
Array
- Output:
Array
- Constraints:
- Objective: Create a summary of genders, the output should be:
{
male: 3,
female: 4,
non-binary: 1
}
- Input:
Array
- Output:
Object
- Constraints: Use
reduce
- When you are passing all tests, run
os submit
- Select your current session
- Select
Let's Get Functional
- If you pass all tests, you will get a green light!