How to use Functions returned by Functions: BEHIND THE SCENES!
Welcome! : ) Hi! We will discuss an amazing tool, H ow to use Functions returned by Functions. Let's get started! Code: This is the code we will be working with. We have an add(x, y) function and a multiply(x, y) function that perform their corresponding operation on their parameters and return the result. The function where the magic starts is determineAddOrMultiply(a) . This function takes in an argument and if that argument is greater than 5 it returns the FUNCTION add . Else, if the argument is equal to or less than 5 it returns the FUNCTION multiply . Note: I’m emphasizing that we are returning Functions because, as you can see in the diagram above, we are not using parentheses after the name of the function and therefore we are not calling the function. By using this syntax we are referring to the function itself, a reference to the entire structure that the function represents....