Skip to content

Instantly share code, notes, and snippets.

@kentquirk
Last active September 10, 2016 16:22
Show Gist options
  • Save kentquirk/bd095bc39500d7fa9c6b50eb013059f3 to your computer and use it in GitHub Desktop.
Save kentquirk/bd095bc39500d7fa9c6b50eb013059f3 to your computer and use it in GitHub Desktop.
Most generic JS
var output = {}
for (var i=0; i<input.length; i++) {
if (output[input[i].owner] == undefined) {
output[input[i].owner] = [input[i].pet]
} else {
output[input[i].owner].push(input[i].pet)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment