Test case details

Preparation Code

function Obj() { var that = "that"; } Obj.prototype.target = function(arg) { var string = "that: " + this.that + ", arg: " + arg; return string; }; var myObj = new Obj();

Test cases

Test #1

var that = {that: "that"}; var arg = "arg"; Obj.prototype.target.call(that, arg);

Test #2

var that = {that: "that"}; var arg = "arg"; Obj.prototype.target.apply(that, [arg]);

Test #3

var arg = "arg"; new Obj().target(arg);

Test #4

var arg = "arg"; myObj.target(arg);