I'm trying to emulate an object that has a number of methods in JSBin. I don't want to redefine the entire method is JSBin. Mostly because methods are being added frequently and I'm just trying to explore if what I want is even possible. Is there a way that I could create an object so that whatever method was called on it, it would just return an arbitrary value?
var ret = {
//no methods
};
var result = ret.getSomeVal("funny_cat.gif");
console.log(result); //funny_cat.gif
Could something intercept this call to ret
and create the returnSomeVal
method automatically, so that it would just return whatever argument was passed to it?