- Write one function inside another function.
- Make a call to the inner function in the return statement of the outer function.
- Call it fun(a)(b) where a is parameter to outer and b is to the inner function.
- Finally return the combined output from the nested function.
Example 1: This example using the approach discussed above.
Example 2: This example using the approach discussed above, but here the nested function is created differently than previous one.
- Difference between regular functions and arrow functions
- ES6 | Functions
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.