Created
July 9, 2018 12:58
-
-
Save bbg/7d469009036cf960f0f60efdd0558c70 to your computer and use it in GitHub Desktop.
javascript functions 4 ways
This file contains hidden or 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
// function declaration | |
function square(x) { | |
return x * x; | |
} | |
// function expression | |
const square = function(x) { | |
return x * x; | |
} | |
// arrow function expression | |
const square = (x) => { | |
return x * x; | |
} | |
// concise arrow function expression | |
const square = x => x * x; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment