InterviewHubPRO
Section Overview
Q454

Question 454 of 521

Part 7: Execution Context, Functional JS & V8 Engine (404 - 463)

87%
JavaScript Internals (521 Qs)•Part 7: Execution Context, Functional JS & V8 Engine (404 - 463)

What is Function Composition?

It is an approach where the result of one function is passed on to the next function, which is passed to another until the final function is executed for the final result.

javascript
 //example
 const double = (x) => x * 2;
 const square = (x) => x * x;

 var output1 = double(2);
 var output2 = square(output1);
 console.log(output2);

 var output_final = square(double(2));
 console.log(output_final);