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.