Last active
October 4, 2022 08:57
-
-
Save bearzk/82f4eaa221ad359c214748214260167c to your computer and use it in GitHub Desktop.
js function expression & declaration
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
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