Created
April 25, 2018 13:20
-
-
Save arrbxr/0792bf7279fccdd660a4fc066534af0d to your computer and use it in GitHub Desktop.
javaScript function four ways created by arrbxr - https://repl.it/@arrbxr/javaScript-function-four-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
| // JavaScript Function Four Ways | |
| // 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 Funcrion Expression | |
| const square = x => x*x; | |
| square(6); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment