моя проблема здесь, что я не понимаю, как делает метод, называемый «objectchanger» работает здесь является источникомПередача по ссылке в JavaScript (вызываем метод)
function test()
{
this.value=5;
}
test.prototype.Add=function()
{
this.value++;
};
var obj = new test();
obj.Add();
alert(obj.value);
function objectchanger(fnc, obj)
{
fnc.call(obj);
//obj.fnc(); >> without this line of code it works fine but why?????
//why i don't need to write this code --
}
objectchanger(obj.Add, obj);
alert(obj.value); // the value is now 7