- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

HOC or Higher Order Functions in JavaScript are a special type of functions that receives another function as argument or have a function set as their return value or do both. HOC along with closures is a very powerful tool in JavaScript.

We are required to write a JavaScript Higher Order Function that can be used to obtain the product of two numbers.

Following is the code −

const num1 = 24; const num2 = 5; const productHOC = num1 => { return product = num2 => { return num1 * num2; }; }; console.log(productHOC(num1)(num2));

Following is the output in the console −

120

- Related Questions & Answers
- Cartesian product of two sets in JavaScript
- How to get the product of two integers without using * JavaScript
- Finding product of Number digits in JavaScript
- Maximum product of any two adjacent elements in JavaScript
- Recursive product of all digits of a number - JavaScript
- Product sum difference of digits of a number in JavaScript
- Find the largest palindrome number made from the product of two n digit numbers in JavaScript
- Maximum Product of Two Numbers in a List of Integers in JavaScript
- Dash separated cartesian product of any number of arrays in JavaScript
- Largest product of n contiguous digits of a number in JavaScript
- Maximum Product Subarray - Using Two Traversals in C++
- How to find the product of two binary numbers using C#?
- Python Program to Find the Product of two Numbers Using Recursion
- C++ Program for dot product and cross product of two vectors
- Finding product of an array using recursion in JavaScript

Advertisements