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

The use of the semicolon in front of;function($,undefined) in jQuery_jquery

WBOY
Release: 2016-05-16 16:25:49
Original
1027 people have browsed it

;(function($){$.extend($.fn...

Generally, there is a semicolon in front of some JQuery functions. Adding a semicolon in front can be used for many purposes:

1. Prevent syntax errors from occurring in high compression after multiple files are integrated into one file.

2. This is an anonymous function. Generally, js libraries use this self-executing anonymous function to protect internal variables (function(){})().

3. Because undefined is an attribute of window, after it is declared as a local variable, if there are variables in the function that are compared with undefined, the program does not need to search for undefined to window, which can improve program performance.

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!