Home > Web Front-end > JS Tutorial > body text

Introduction to JavaScript advanced syntax_javascript skills

WBOY
Release: 2016-05-16 18:51:30
Original
1162 people have browsed it

(function($){})(jQuery);

It’s actually relatively simple, you need to understand a few concepts:

1. (), in JavaScript () means executing a method, such as:

function x(){

alert("xxx");

}

var a = x; // No call, a is a function

var a = x(); //The function is called, and the value of a is the result of the call: undefined

2. jQuery is a jQuery object, which means that when calling a function, a parameter passed in is a jQuery object.

There’s nothing to say about this

3. (function($){}) This is an anonymous function, the formal parameter is $, and parentheses are definitely required.

You can understand it at a glance. The above formula is equivalent to

var f = function($){};

f(jQuery);

Look at it now, it’s neither simple nor weird...

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