this = thisArg passiert im Grunde auch, aber eben nicht innerhalb von apply, sondern im Falle von myFn.bind.apply() innerhalb von bind. Und apply() gibt hier das erste arg im array and bind als thisArg, was wiederum ein this = thisArg (was hier dem ersten arg entspricht) in myFn macht.Das
thisArg, dass du an apply(thisArg) übergibst, gilt nicht für myFn sondern für bind.Noch ein Versuch:
Wenn du
function myFn(arg1, arg2, arg3) {} hast und dann `myFn.apply({ foo: 'bar' }, [1, 2, 3]) machst... Was hat arg1,2,3 ?Und jetzt übertrage das auf
bind.apply(myFn, [{ foo: 'bar' }, 1, 2, 3]). Mit welchen Parametern wird bind aufgerufen?
Zuletzt bearbeitet: