laitimes

Javascript Basics pick up the difference between handwriting apps, callapply, and call using scenarios for handwritten apps and calls

<h1 class="pgc-h-decimal" data-index="01" data-track="1" > the difference between applyly and call</h1>

Both apply and call can change the point of this of the function, the difference is in the different parameters, the specific use is as follows:

<h1 class="pgc-h-decimal" data-index="02" data-track="5" > usage scenario</h1>

For example, take the maximum value in the array:

Another example is handling arrays of classes, such as arguments:

<h1 class="pgc-h-decimal" data-index="03" data-track="11" >apply and call are handwritten implementations</h1>

For apply, the implementation is as follows:

For call, the implementation is as follows: