Skip to content

Instantly share code, notes, and snippets.

@Spaxe
Created March 16, 2015 00:43
Show Gist options
  • Save Spaxe/547655c7508ba7c0c24b to your computer and use it in GitHub Desktop.
Save Spaxe/547655c7508ba7c0c24b to your computer and use it in GitHub Desktop.
It's 2015 and I still have to write this to iterate through objects in Javascript.
// Util functions
var Util = {
loop: function (obj, callback) {
for (var x in obj) {
if (obj.hasOwnProperty(x)) {
callback(x, obj[x]);
}
}
return obj;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment