Higher Order Function (HOF)

A function that takes a function as a parameter or returns a result. In other words, a higher order function takes a parameter and calls it at a necessary point, or creates a closure. (Java scripts can be used as value as first-class objects.)

A higher order function is oriented towards immutability and rejects mutable data that changes the external state. In other words, the pure function is a functional programming that suppresses the side effect as much as possible.

.sort( )

= (!) Changes the original array (ascending order)

Return Value

Arrange the elements of the array properly and returns the sorted array.

.reverse( )

= (!) Changes the original array (descending order)

Return Value

Arrange the elements of the array properly and returns the sorted array.

.forEach( callback : ( value : T/ index : number/ array: T[ ] ) => void)

  • Use forEach instead of for syntax

  • It traverses the array and executes the callback function given as an argument for each element of the array. The return value is undefined.

.map( callback : ( value : T ))

.filter( callback : ( value : T / index : number / array : Array ))

.reduce( callback : ( ) => )

.some( callback : ( ) => )

.every( callback : ( ) => )

.find( predicate : ( ) => )

.findIndex( predicate ( ) )

Last updated

Was this helpful?