Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function myFunction(number1) {
function add(number2) {
/* The number1 variable is accessible from this function,
because number1 has been defined outside of the add function */
return number1 + number2;
/* As we saw earlier, add is a function but also a variable;
I can render it as a result of myFunction.
Note that when you return a function without the (),
you are returning the function definition, you are not calling
the function to execute. This allows you to call the function later.*/
return add;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment