Skip to content

Instantly share code, notes, and snippets.

@pikajude
Created March 2, 2021 22:16
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 pikajude/b9b28919d89961e39fd7084ac50a1c57 to your computer and use it in GitHub Desktop.
Save pikajude/b9b28919d89961e39fd7084ac50a1c57 to your computer and use it in GitHub Desktop.
// Here's a function that takes three inputs, aka arguments.
function myFunction(x, y, z) {
let a = x + y;
return a * z;
}
// Calling the function means that those values are "bound" to the variable names we chose when defining the function.
// This function call:
myFunction(1, 2, 3);
// is equivalent to:
{
// the inputs: myFunction(x, y, z)
let x = 1;
let y = 2;
let z = 3;
// after those variables are set, the actual body of the function executes:
let a = x + y;
return a * z;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment