Home  >  Article  >  Web Front-end  >  Understanding the execution order of (function(){})() in jQuery_jquery

Understanding the execution order of (function(){})() in jQuery_jquery

WBOY
WBOYOriginal
2016-05-16 17:41:011278browse

Generally speaking, the sequence is as follows: first calculate the first parenthesis, find that the expression inside is a function, return the reference (pointer) of the anonymous function, and the last parenthesis is the actual parameter and union of the anonymous function. implement.
Example:
Calculate the sum of two numbers.
JavaScript:

Copy code The code is as follows:

(function sum(a,b ){ //sum can also be removed here and appear in the form of an anonymous function
alert(a b);
})(7,8);

C:
Copy code The code is as follows:

int sum(int a,int b){return a b;}
void main(){
int (*pt)(int,int); //The function pointer is defined here
pt = sum;
printf("%d",pt(7 8) );
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn