A brief talk on the JavaScript bind method

Source: Internet
Author: User

Recently went to the interview, with the interviewer chatted a lot of things on the basis of JS, one of the problems is to talk about apply, call, bind understanding and differences. Suddenly a Leng, apply, call I know, often use things, bind is what ghost!!! It seems like I've seen it, I've read a similar article, but ... No, I don't remember. Is it the same bind as jquery's event binding ...

Since I do not know, then the summary of the next ~

I. Apply and call

Referring to this, I would probably take notes. In JavaScript, the point of this is a problem that is often addressed,

Instead, apply and call are used to handle the point of the function's body this when the function is executed. So the use of apply and call is consistent, that is, to change and determine the function execution when the this point, the difference is that after the argument is an array, call is a bunch of parameters.

  

A brief talk on the JavaScript bind method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.