Skip to content

Instantly share code, notes, and snippets.

@Chalarangelo
Created September 13, 2017 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chalarangelo/5d2dd39ec12566d516b2c881f4748c23 to your computer and use it in GitHub Desktop.
Save Chalarangelo/5d2dd39ec12566d516b2c881f4748c23 to your computer and use it in GitHub Desktop.
// 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