Hi, so I have a question dealing with something that I’ve been curious about off and on for some time now. In the below example, the curried functions seem to automatically be known to JavaScript to be x, y, z as they appear in the add function on execution.
How does JavaScript “know” to interpret or know to feed to the interpreter that 10 = x, 20 = y, and 30 = z?
Is it simply the order in which the add function parameters are in left-to-right and the curried functions in from top-to-bottom?
Thank you in advance for reading/answering my post.
function add(x) {
// Add your code below this line
return function(y) {
return function(z) {
return x + y + z;
}
}
// Add your code above this line
}
add(10)(20)(30);