JavaScript higher-order functions
Last updated
Last updated
With we learned that we could pass in variable values as "parameters", but with higher-order functions we can pass in other functions!
In JavaScript, we can create our own higher-order functions, or use some of the many built-in for us:
to iterate through each element in an array
to perform an operation on each element in an array (i.e. matrix algebra)
to eliminate elements of an array that do not meet a condition
to boil down a set of values into one value (e.g. finding a sum of values)
to arrange a set of values with some defined order
to find out if all or any elements in an array meet a condition