double function call javascript

Solutions on MaxInterview for double function call javascript by the best coders in the world

showing results for - "double function call javascript"
Katelynn
01 Sep 2020
1//It means that the first function ($filter) returns another 
2//function and then that returned function is called immediately. 
3//For Example:
4function add(x){
5  return function(y){
6    return x + y;
7  };
8}
9
10var addTwo = add(2);
11
12addTwo(4) === 6; // true
13add(3)(4) === 7; // true