Something like this, but not using __proto__
:
var o = {
i :2
};
var f1 = function(){
alert(f1.i);
}
f1.__proto__ = o;
o.i = 3;
f1(); //3
This question have not an answer here: How to set the prototype of a JavaScript object that has already been instantiated?