There is an object named devark
:
var devark = {
init: function() {
var obj = this;
obj.assignHandlers();
},
assignHandlers: function() {
var obj = this;
document.getElementById("menu-toggler").onclick = obj.documentFunctions[0];
},
documentFunctions: [
function() {
toggleClass(this, "opened");
}
]
};
When I call the init
method on window.load
, it works fine. However, when it tries to call another method called assignHandlers
of the object, it throws an error:
[17:54:33.192] TypeError: obj.assignHandlers is not a function
I'm puzzled as to why this error is occurring. Can someone explain?