Last active
May 23, 2016 19:13
-
-
Save remarkablemark/313055e4540c2f6199ad6efcf53a31ef to your computer and use it in GitHub Desktop.
Convert arguments from array-like object to array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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