Objective
The cause is that I want to be in jquery Ajax to decide whether or not to proceed with the AJAX request based on the return value, which is a conditional loop that pops out of the condition. You can use the while loop, but it's good to think about it or to call it recursive.
Call a recursive function
The recursive function is probably the case. Do not meet the criteria to re-execute this function
function f () { // do something if(1) { } Else{ f (); } }
Parentheses operators and self-executing functions
The parentheses operator in JS refers to (), which generally has two functions.
1, immediately after the function to execute this function, such as f ()
2, calculate the expression, such as
// Print 2(1+1)
Calculates a function based on () calculating the effect of an expression
// returns the function itself (function () {// do something})
Execute the function immediately after () followed by the function
// returns the function itself (function () {// do Something}) ()
Of course, what parameters are required for a function, and () What arguments are passed, as in normal function execution
Elevation of function declarations
In general, the JS execution order is ordered, and the variable will return undefined if it is not declared, but it can be used before declaring a function () {}, because JS will take precedence over the code that declares the function.
JS self-executing function, call recursive function, parentheses operator, function declaration promotion