In the following example :

function makeAddFunction(amount) {
function add(number) {
return number + amount;
return add;

var addTwo = makeAddFunction(2);
var addFive = makeAddFunction(5);
show(addTwo(1) + addFive(1));

The answer is 9. I understand very well that makeAddFunction(2)'s value is 2 and is used to replace the term (amount) in the first line and the same applies to makeAddFunction(5) for 5 as a value.

What I cannot explain though is how the program uses 1 as a value for add(number).There is no link at first glance between function add(number) and addTwo(1) or addFive(1). Can anyone show me how the program sets 1 as a value for those last two variables?

Thank you!