How does greaterThanTen(9)
become the y
variable in the return function? What I mean is how does the parameter (9)
become the y
in the return function argument? Wouldn't 9
be replaced with x
since greaterThanTen = greaterThan(10)
? Wouldn't the 9
just replace the x = 10
parameter? I just don't understand how that 9
parameter is getting to y
in the return function.
function greaterThan(x) {
return function(y) {
return y > x;
};
}
var greaterThanTen = greaterThan(10);
show(greaterThanTen(9));