Created
April 17, 2017 06:38
-
-
Save qzm/683940a7fbd7bcff022da9261da95cd6 to your computer and use it in GitHub Desktop.
Convert an Array-like object to a real 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 an Array-like object to a real Array. | |
*/ | |
function toArray (list, start) { | |
start = start || 0; | |
var i = list.length - start; | |
var ret = new Array(i); | |
while (i--) { | |
ret[i] = list[i + start]; | |
} | |
return ret | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment