Created
September 13, 2017 19:39
-
-
Save Chalarangelo/5d2dd39ec12566d516b2c881f4748c23 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
// Create a function. | |
function f(x){ | |
return x * x; | |
} | |
// Use the function. | |
f(5); // 25 | |
// Create an anonymous function and assign | |
// it to a variable. | |
var g = function(x){ | |
return x * x; | |
} | |
// Now you can pass the function around. | |
var h = g; | |
// And use it | |
h(5); // 25 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment