Skip to content

Instantly share code, notes, and snippets.

@Sigmus
Created February 12, 2013 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sigmus/4773187 to your computer and use it in GitHub Desktop.
Save Sigmus/4773187 to your computer and use it in GitHub Desktop.
Optional parameters pattern
function sum(a, b, c, d) {
a = a || 1;
b = b || 2;
c = c || 3;
d = d || 4;
return a + b + c + d;
}
@stoyan
Copy link

stoyan commented Feb 12, 2013

sum(0,0,0,0); // ?! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment