

InterviewSolution
Saved Bookmarks
1. |
Differentiate between .call and .apply. |
Answer» <html><body><table><tbody><tr><th>.call</th><th>.apply</th></tr></tbody><tbody><tr><td>.call is used to invoke the functions, and the first <a href="https://interviewquestions.tuteehub.com/tag/parameter-244658" style="font-weight:bold;" target="_blank" title="Click to know more about PARAMETER">PARAMETER</a> will become the value of this within the function created by the developer.</td><td>.apply is also used to invoke the functions but it takes an array of arguments. This array works as the next <a href="https://interviewquestions.tuteehub.com/tag/argument-239210" style="font-weight:bold;" target="_blank" title="Click to know more about ARGUMENT">ARGUMENT</a> and the function works this way.</td></tr><tr><td>.call is used to call the method which takes the owner object as its argument.</td><td>.apply method is used to write methods. These methods can be used on several objects.</td></tr><tr><td>It accepts two parameters namely objectInstance and arguments</td><td>It accepts two parameters namely objectInstance and arrayofArguments</td></tr><tr><td>.call takes several arguments <a href="https://interviewquestions.tuteehub.com/tag/separated-2256042" style="font-weight:bold;" target="_blank" title="Click to know more about SEPARATED">SEPARATED</a> by <a href="https://interviewquestions.tuteehub.com/tag/commas-923101" style="font-weight:bold;" target="_blank" title="Click to know more about COMMAS">COMMAS</a>.</td><td>.apply takes several arguments with the <a href="https://interviewquestions.tuteehub.com/tag/help-239643" style="font-weight:bold;" target="_blank" title="Click to know more about HELP">HELP</a> of an array of arguments.</td></tr></tbody></table></body></html> | |