Introduction to JavaScript advanced syntax

Source: Internet
Author: User

(Function ($) {}) (jQuery );

In fact, it is relatively simple to understand several concepts:

1. (). In JavaScript, () indicates executing a method, for example:

Function x (){

Alert ("xxx ");

}

Var a = x; // no call. a is a function.

Var a = x (); // call the function. The value of a is the result of the call: undefined

2. jQuery is a jQuery object. It indicates that when a function is called, a parameter is input as a jQuery object.

There's nothing to say about it.

3. (function ($) {}) This is an anonymous function. The parameter is $, which is required by parentheses.

In this way, we can understand that the above formula is equivalent

Var f = function ($ ){};

F (jQuery );

Now let's take a look, that is, it's not simple or weird...

Related Article

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.