Software-Engineering
# What are Higher Order Functions ?
take other function as a parameter or return a function as value.
the function passed as parameter is called callback.
# Callback
A callback can be passed as parameter to other functions
Output: 27
# Return Function
Higher order functions return a function as a value
Output: 11
For example the forEach method uses callback:
Output: 21
A simpler option for the example above would be
Output: 21
# Setting Time
In JS we can execute some activity for a specific time.
We can wait for something to execute.
# setIntervall
we use this higherOrderFunction to repeatedly execute a specified function at fixed time intervals.
# setTimeout
we use this higherOrderFunction to execute a specified function after a fixed time only once.