Created
July 14, 2010 17:52
-
-
Save MikeGrace/475753 to your computer and use it in GitHub Desktop.
Faking default param passing in JavaScript function
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
function defaultParams(name, class, id) { | |
if (class == null) class = "CS 101 [default]"; | |
if (id == null) id = "Not yet set"; | |
return "Name: " + name + ", Class: " + class + ", ID: " + id; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment