Summarize the next JS in the anonymous function of writing ~ For several days did not blog ...

Source: Internet
Author: User

Little brother recently is very upset Ah, not only to continue to the current front-end small white, the future of the front-end siege lion's identity bitter study, but also to use the remaining time to complete the graduation design. I knew so, originally I for Mao to apply for mathematics such a bitter force professional .... Yesterday all day time in research Bishi, feel the code already did not know me ... Today in the study, suddenly found the anonymous function call method. Originally thought that the anonymous function is a high-cold creature, only the following method of invocation:

(function() {     alert (' water '

Of course... Set the parameter to the same method as above:

(function(i) {alert (i);}) (

Later read a script home of an article, only to find this goods originally so no moral integrity ... All kinds of call methods can make this goods obediently work ...

The first is chained invocation:

(functionreturn  Arguments.callee;}) (

The output is Water,down

Then there are various calling methods: First of all, say the most efficient of execution:

void function () {alert (' water ')

And then the other way:

~function() {alert (' water ');} ();! function () {alert (' water ');} (); -function() {alert (' water ');} (); +function() {alert (' water ');} ();

And finally, the one who took off his pants and fart.

(function() {alert (' water ');} ());

。。。 Summed up, we think that the good use of which it ~ small brother here thank the original: http://www.jb51.net/article/24759.htm

Finally, I wish you all the programming road more and more wide.

Summarize the next JS in the anonymous function of writing ~ For several days did not blog ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.