I was wondering if it's possible to alter the return value of a function, i.e:
var foo = function(options) {
var options = options || {},
bar = options.bar || "bar",
baz = options.baz || "baz";
return {
bar: bar,
baz: baz
}
};
I would like to call it like this:
foo({
bar: this.bar + "ret"
});
And my expectation is:
>>> { bar: "barret", baz: "baz" }
But I get this instead:
>>> { bar: "undefinedret", baz: "baz" }
How do we do that?