A global object as such “Obj” is created:
Obj = {
gtm : {},
method: function(){console.log("Method is called");}
};
In some other places Obj.method() is used.
My question is can I extend the code for “Obj” in any way to prevent the call to Obj.method().
I don’t want to rewrite or remove the codes in other places because that would be a lot of changes. Instead, I would like to change the original code so that on some condition I will just not call the method.
Proxy is not an option as Proxy will require me to change the calls in other places as well. And Proxy does not work in IE 11.
Can I rather override the constructor and achieve what I want?
Thanks and Regards
Such:
If the value of
thisor any arguments matter, you'll need to pass them along.e.g.