Skip to content

Instantly share code, notes, and snippets.

@jpbassalot
Created January 31, 2014 15:23
Show Gist options
  • Save jpbassalot/8734083 to your computer and use it in GitHub Desktop.
Save jpbassalot/8734083 to your computer and use it in GitHub Desktop.
Convert Array to Object - Pure Javascript
function toObject(arr) {
var rv = {};
for (var i = 0; i < arr.length; ++i)
if (arr[i] !== undefined) rv[i] = arr[i];
return rv;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment