Solution Review: Calculate Score
This lesson will explain the solution to the problem in the previous lesson.
We'll cover the following...
We'll cover the following...
Solution #
Explanation #
To solve this challenge, we make use of two higher-order functions, filter and reduce. Before we discuss the code, let’s understand these functions.
filter: takes a callback function as a parameter and returns a new array containing all the elements from the given array that satisfy the condition set by this function. It also takes an optional parameter, the value thisArg, which specifies the value of this to use when executing the callback. ...