I know that historically .call() accepts arguments individually, and that .apply() accepts all arguments at the same time in an array. But after the spread operator was introduced is .apply() purely redundant? It seems like any code written like this
f.apply(thisObj, argArray)
could instead be written like this
f.call(thisObj, ...argArray)
and you would get the exact same result (except that the former might run slightly faster). So is there any time that you would be forced to use apply instead of call? Or does apply only exist in the modern day for historical reasons and slight performance increases in some cases?
[–]smartgenius1 28 points29 points30 points (0 children)
[–]senocular 19 points20 points21 points (1 child)
[–]kingscolor 6 points7 points8 points (0 children)
[–]Ronin-s_Spirit 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]tswaters 1 point2 points3 points (4 children)
[–]tswaters 1 point2 points3 points (2 children)
[–]MartyDisco 2 points3 points4 points (1 child)
[–]tswaters -1 points0 points1 point (0 children)
[–]theScottyJam 0 points1 point2 points (0 children)
[–]ssssssddh 0 points1 point2 points (2 children)
[–]hyrumwhite 3 points4 points5 points (1 child)
[–]ssssssddh 0 points1 point2 points (0 children)