Last active
March 15, 2017 06:43
-
-
Save jaybill/718a5e5447e77d149c6e2485522a9dc3 to your computer and use it in GitHub Desktop.
Execute any property of an object that's a function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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