Skip to main content
InterviewHubPRO
Section Overview
Q454

Question 454 of 536

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

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

What is Function Composition?

senior LevelCode ExampleMemory Management

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);