Javascript callback function

Source: Internet
Author: User

This article is suitable for beginners of JavaScript.

Gossip first. In China, there is such a phenomenon: No matter what word or concept, there will always be some people who interpret these things as if they do not understand what they think they are very powerful. In fact, I don't know how many 2. I personally advocate conciseness and clarity. What are the words and concepts? If you can use a short sentence or two to let everyone understand, this is the skill. Now, let's get started with the topic.

What is callback "callback function" in JavaScript? In my words, Method B is used as a parameter to pass a method, after Method A is executed, execute another specified function (function B here ). Let's look at a column:

 
<HTML>  

in main (B), B is called a callback function. Is it easy to understand? Why can't I put B's call into the main function? Yes, but then your main method can only call B. Here we pass B to a main, or a to a main. The callback method in main is a dynamic callback function. Here is the advantage.

Related Article

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.