Open In App

What is a First Order Function in JavaScript ?

Last Updated : 29 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

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.

Javascript




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


Output

140

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads