This article explains the next JS asynchronous operation when the callback function to control the order of execution, interested friends can refer to the following
Requirements: Fun A () {Asyn (Parm1, Parm2, onsuccess () {});} Fun B () {Asyn (paem1, Parm2, onsuccess () {});} function B requires execution after function A Asynchronous execution If the direct use of a (); B (); is not able to meet the execution conditions. Consider passing B as a callback function to a, and then a onsucess execution of B functions A (b); to achieve functional requirements. JS is single-threaded . 1, when calling a function, if the argument is more than the number of definitions, the extra parameters will be ignored, if less than the number of definitions will be automatically given undefined value. 2, a function definition that is declared with a function statement may not appear in a loop or a conditional statement, but it can appear in any JS expression if it is a function definition with a function direct measure method. 3, Arguments object Function arguments object is like an array, which holds the actual parameters of the function call, can be used arguments[0], arguments[1], arguments[2 ... To reference these parameters, even if they are not in the definition of the function. But arguments is not really an array object. function A (x,y) { Arguments[0]//Represents the first parameter x Arguments[1]//Represents the first parameter y arguments[2]//Represents the third parameter, The premise is that when the function is invoked, three parameters ... arguments.length//representing the actual number of incoming arguments Arguments.callee (x,y)//calling itself} are passed in. The arguments object has a length property that represents the number of arguments actually passed in when the function was called. The arguments object also has a callee property that refers to the currently executing function, which is particularly useful in anonymous functions. 4, the length property of the function (yes, the function also has the length property) andArguments.length, the Length property of a function represents the number of formal parameters when a function is defined, not the actual number of arguments when the function is called. You can use Arguments.callee.length to call the length property of a function.