/loop-refactor

Primary LanguageJavaScript

#Refactor Loops Using Higher-Order Functions

Refactor the five functions in main.js to use higher-order functions (HOFs) rather than for-loops.

Choose from the following HOFs:

  • map
  • filter
  • reduce
  • every
  • some

Each of these HOFs should be used exactly once in the refactor.

Before refactoring, examine the existing code and tests for each function in order to understand the expected inputs and outputs.

Run the command mocha to test. The tests check for expected outputs and the absence of for-loops. Do not submit your solutions until all tests are passing.