Skip to content

Instantly share code, notes, and snippets.

@bearzk
Last active October 4, 2022 08:57
Show Gist options
  • Save bearzk/82f4eaa221ad359c214748214260167c to your computer and use it in GitHub Desktop.
Save bearzk/82f4eaa221ad359c214748214260167c to your computer and use it in GitHub Desktop.
js function expression & declaration
plus(1, 2) // this won't complain, as add() is hoisted
minus(2, 1) // this will complain, as minus is defined later
// expression
function plus(x, y) {
return x + y;
}
// declaration
const minus = function (x, y) {
return x - y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment