Open In App

What is a First Order Function in JavaScript ?

A First Order Function is just a normal regular function that does not take any function as one of its parameters and also it does not return another function as its return value inside its body. It is a simple function that accepts the parameters of different data types either primitive or non-primitive and it may or may not return a value as a result of the calculations performed on the passed parameters. A First Order Function can be declared using any of the methods available in JavaScript.

Example: The below code will explain how you can declare a general first-order function in JavaScript.




function firstOrderFunc(num1, num2){
    console.log(num1*num2);
}
firstOrderFunc(4, 35)

Output
140
Article Tags :