Examples of methods that use Callback Functions
Callback Examples
Several JavaScript functions already take in callbacks as arguments.
map()
The map() method calls a callback function on each element in the array and then returns a new array with those results.
Notice how the map() method uses a callback function:
filter()
The filter() method removes elements in an array that do not pass a certain criteria defined by a callback function.
Notice how the filter() method is used to remove elements in an array that are not even: