Here is an example of my current code :
var myObject = new Obj();
if(something)
myObject.method1(arg1, arg2);
else
myObject.method2(arg1, arg2);
and how I declared my obj :
function Obj() { }
Obj.prototype.method1 = function(a, b) { }
Obj.prototype.method2 = function(a, b) { }
Since i'm doing this kind of test a bunch of time, I was wondering if it was possible to do something like that :
if(something)
var method = method1;
else
var method = method2;
myObject.method(arg1, arg2);