Skip to content

Instantly share code, notes, and snippets.

@remarkablemark
Last active May 23, 2016 19:13
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 remarkablemark/313055e4540c2f6199ad6efcf53a31ef to your computer and use it in GitHub Desktop.
Save remarkablemark/313055e4540c2f6199ad6efcf53a31ef to your computer and use it in GitHub Desktop.
Convert arguments from array-like object to array.
'use strict';
/**
* Convert arguments from array-like object to array.
*
* @param {...*}
* @return {Array}
*/
function argumentsToArray() {
return Array.prototype.slice.call(arguments, 0);
}
// test
console.log(argumentsToArray('foo', ['bar', 'baz'], 42, { 'hello': 'world' })); // ["foo", Array[2], 42, Object]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment