Created
November 14, 2011 02:13
-
-
Save emkay/1363076 to your computer and use it in GitHub Desktop.
Function Examples
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
| // add | |
| var add = function (a, b) { | |
| return a + b; | |
| }; | |
| // or | |
| function add (a, b) { | |
| return a + b; | |
| } | |
| // invoke | |
| add(5, 5); // returns 10 | |
| // double | |
| var double = function (a) { | |
| return a * 2; | |
| }; | |
| // or | |
| function double (a) { | |
| return a * 2; | |
| } | |
| //invoke | |
| double(7); // returns 14 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment