하나의 함수에서 다른 함수로 모든 인수를 전달하고 this
을 보내는 간단한 방법이 있습니까?.call과 .apply의 차이점
나는이 시도 : http://jsfiddle.net/v92Xr/
var f1 = function() {
f2.call(this, arguments);
};
var f2 = function() {
console.log(arguments);
};
f1("abc", "def", "hij");
을하지만 F1의 모든 인수가 F2 인수 0 적층되어 나에게 잎 :
f2->arguments[0] == f1->arguments
좋아하고 내가 대신을 apply
방법을 실행할 때 작품 : http://jsfiddle.net/v92Xr/1/
var f1 = function() {
f2.apply(this, arguments);
};
var f2 = function() {
console.log(arguments);
};
f1("abc", "def", "hij");
call
과 apply
의 차이점은 무엇입니까?