1.0.0 • Published 2 years ago
lets-get-functional-khamal22 v1.0.0
lets-get-functional
An exercise in problem solving in the functional idiom.
Step 0 - Release lodown
If you haven't release your lodown library to
npm(node package manager), follow the steps in this video to do so:
Step 1 - Setup
- Run
os installto installLets Get Functional - Copy the name of your
lodownpackage. It should be something likelodown-oliviasaborush - In your bash terminal run the command
npm install --global lodown-oliviasaborushwith your lodown package - In your bash terminal run the command
npm link lodown-oliviasaborushwith your lodown package- These commands will not work unless you use your lodown name
- Open
index.js - Update line 6 of
index.jsto reference yourlodownlibrary - It should look something like this:
const _ = require('lodown-oliviasaborush');Step 2 - Solve
- Implement the functions outlined below, using your
lodownlibrary - 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-functionalin your terminalIMPORTANT: Make sure you replace
<YOUR_GITHUB_FOLDERwith your actual github folder in your workspace.
1: maleCount
- Objective: Find the number of male customers
- Input:
Array - Output:
Number - Constraints: use
filter
2: femaleCount
- Objective: Find the number of female customers
- Input:
Array - Output:
Number - Constraints: use
reduce
3: oldestCustomer
- Objective: Find the oldest customer's name
- Input:
Array - Output:
String - Constraints:
4: youngestCustomer
- Objective: Find the youngest customer's name
- Input:
Array - Output:
String - Constraints:
5: averageBalance
- Objective: Find the average balance of all customers
- Input:
Array - Output:
Number - Constraints:
6: firstLetterCount
- Objective: Find how many customer's names begin with a given letter
- Input:
Array,Letter - Output:
Number - Constraints:
7: friendFirstLetterCount
- Objective: Find how many friends of a given customer have names that start with a given letter
- Input:
Array,Customer,Letter - Output:
Number - Constraints:
8: friendsCount
- Objective: Find the customers' names that have a given customer's name in their friends list
- Input:
Array,Name - Output:
Array - Constraints:
9: topThreeTags
- Objective: Find the three most common tags among all customers' associated tags
- Input:
Array - Output:
Array - Constraints:
10: genderCount
- Objective: Create a summary of genders, the output should be:
{
male: 3,
female: 4,
non-binary: 1
}- Input:
Array - Output:
Object - Constraints: Use
reduce
Step 3: Submit
- 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!
1.0.0
2 years ago