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

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

WBOY
Release: 2016-05-16 17:41:01
Original
1295 people have browsed it

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) );
}
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template