- Use map to transform an array
- Use filter to transform an array
- Use reduce to accumulate an array
- Use functions that return functions to abstract functionality
- Define higher order functions
To install
npm install
To run test
npm test
The tests are all passing, refactor the code without breaking the tests/
In array.map.js
- Create a function that transforms each value of the array before it gets pushed into
result
. - Study the three main functions and determine what the similarities and differences are between them
- Create a function named
map
that abstracts the looping structure, it has as arguments, an array and a function - Add the
map
function to all main functions - Refactor using
array.map
, bring in helper functions as anonymous functions
In array.filter.js
- Create a function that checks to see if each value of the array should be pushed into
result
. - Study the three main functions and determine what the similarities and differences are between them
- Create a function named
filter
that abstracts the looping structure, it has as arguments, an array and a function - Add the
filter
function to all main functions - Refactor using
array.filter
, bring in helper functions as anonymous functions
In array.reduce.js
- Create a function to transform each element for each function
- Study the three main functions and determine what the similarities and differences are between them
- Create a function named
reduce
that abstracts the looping structure, it has as arguments, an array, a function, and a startign value - Add
reduce
function to all main functions - Refactor using
array.reduce
, bring in helper functions as anonymous functions
In array.map.js
- From
functions-return-functions
usemultiplyBy
to abstract behavior ondoubleNumbers
- From
functions-return-functions
usepluckProperty
to abstract behavior onpluckName
In array.filter.js
- From
functions-return-functions
usenotDivisibleBy
to abstract behavior ononlyOdds
- In
functions-return-functions
, create a function namedscoreBelow
to abstract score number. Use it to abstract behavior inhasBelow30000CareerPoints
- In
functions-return-functions
, create a function namedstartsWith
to abstract starting letter. Use it to abstract behavior infirstNameStartsWithA
In array.reduce.js
- rom
functions-return-functions
usegroupByProperty
to abstract behavior ongroupByUniversity
- Turn you your neighbor and define what a higher order function is