Skip to content

Instantly share code, notes, and snippets.

@nola
Created November 26, 2013 01:45
Show Gist options
  • Select an option

  • Save nola/7652181 to your computer and use it in GitHub Desktop.

Select an option

Save nola/7652181 to your computer and use it in GitHub Desktop.
Function Variable Arguments Shorthand
function myFunction( myString, myNumber, myObject, myArray, myBoolean ) {
// do something...
}
myFunction( "String", 1, [], {}, true );
//shorthand
function myFunction() {
console.log( arguments.length ); // Returns 5
for ( i = 0; i < arguments.length; i++ ) {
console.log( typeof arguments[i] ); // Returns string, number, object, object, boolean
}
}
myFunction( "String", 1, [], {}, true );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment