Skip to content

Instantly share code, notes, and snippets.

@mhairston
Created July 29, 2015 17:20
Show Gist options
  • Save mhairston/ca41b51a45e8e9584f18 to your computer and use it in GitHub Desktop.
Save mhairston/ca41b51a45e8e9584f18 to your computer and use it in GitHub Desktop.
Convert JS Array-like to Array
// 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