Created
May 18, 2017 12:54
-
-
Save lenafaure/15b0e838978344b9695f3c327d50263a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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