Skip to content

Instantly share code, notes, and snippets.

@jaybill
Last active March 15, 2017 06:43
Show Gist options
  • Save jaybill/718a5e5447e77d149c6e2485522a9dc3 to your computer and use it in GitHub Desktop.
Save jaybill/718a5e5447e77d149c6e2485522a9dc3 to your computer and use it in GitHub Desktop.
Execute any property of an object that's a function.
var init = {
foo: function(){ console.log('foo') },
bar: function(){ console.log('bar') },
baz: 3.14
}
for (var key in init) {
if (!init.hasOwnProperty(key)) {
continue;
}
if(typeof init[key] == 'function'){
init[key]();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment