My problem is pretty easy to understand. I have a JSON object (see code) and I will automatically call all functions of this object in the order that those appears.
.
var installer = {
a : function() {
...
}
b : function() {
...
}
};
for(var func in installer) {
fn.call(document);
};
Have you any idea why the previous code doesn’t work ? I’m sorry, I’m a beginner in javascript.
Thanks in advance !
Regards.
You declare
var funcas the variable to loop through the members ofinstaller, yet you usefn.call(...). Where didfncome from?Should you be able to do:
installer[func].call(document)instead offn.call(document).Also your functions declared in the installer object don’t take any arguments, yet you’re passing
documentas an argument.[updated code to add missing
.calltoinstaller[func](document)]