i have a question about a foor loop. Why is my output every time "C" ?
function Dummy(){}
Dummy.prototype.a = function(){ console.log("Hello from A"); };
Dummy.prototype.b = function(){ console.log("Hello from B"); };
Dummy.prototype.c = function(){ console.log("Hello from C"); };
function hooks(obj){
for(method in obj){
original = obj[method];
obj[method] = function(){
console.log("Overrid %s", method);
original();
};
}
}
var instance = new Dummy();
hooks(instance);
instance.a();
instance.b();
instance.c();
I would to create an hookable middleware