Skip to content

Instantly share code, notes, and snippets.

@shesek
Created July 30, 2011 11:19
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 shesek/1115427 to your computer and use it in GitHub Desktop.
Save shesek/1115427 to your computer and use it in GitHub Desktop.
JavaScript default arguments
window.setDefault = function (args) {
for (var i = args.length + 1; i<arguments.length; i++) {
args[i-1] = arguments[i];
}
};
window.setDefault=function(a){for(var b=a.length+1;b<arguments.length;b++)a[b-1]=arguments[b]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment