Skip to content

Instantly share code, notes, and snippets.

@glebcha
Created September 19, 2013 11:35
Show Gist options
  • Save glebcha/6622136 to your computer and use it in GitHub Desktop.
Save glebcha/6622136 to your computer and use it in GitHub Desktop.
function do_smth_with_arguments(/* lots of arguments here */){
var args = Array.prototype.reverse.call(arguments);//call array method whatever you like
for(var i=0; i<args.length; i++){
alert(args[i]);//do whatever you want with each argument passed
}
};
do_smth_with_arguments.apply(null, ['one','two','three']);//null points to 'this' context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment