Created
July 29, 2015 17:20
-
-
Save mhairston/ca41b51a45e8e9584f18 to your computer and use it in GitHub Desktop.
Convert JS Array-like 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
// Convert Array-like object to Array: | |
var unboundSlice = Array.prototype.slice; | |
var slice = Function.prototype.call.bind(unboundSlice); | |
function list() { | |
return slice(arguments); | |
} | |
var list1 = list(1, 2, 3); // [1, 2, 3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment