In JavaScript, functions are callable.
Can I remove this attribute from a function, leaving only a normal object?
var foo = function () {}; foo.[[ca
this isn't an elegant solution, the idea is to create the "enabled" attribute as a flag to know if the function is enabled:
var foo = function () { if(!arguments.callee.enabled){ throw "function disabled"; } console.log("Hello"); } foo.enabled = true; foo(); foo.enabled = false; foo();