Basic Javascript knowledge in Jquery source code (1)

Source: Internet
Author: User

Basic Javascript knowledge in Jquery source code (1)
Jquery Source Code involves a lot of native js knowledge and concepts. This article is a summary of my work in learning the two. If you have any mistakes, please let us know. You can check the source code and find that the overall structure is as follows: (function (window, undefined) {// code}) (window); to understand this writing method, there are two methods to define functions in js: 1. function declaration function functionName () {// code} 2. function expression var functionName = function () {// code} the function defined in this way is also called an anonymous function (without a function name). It can be considered to assign a function expression to a variable. Call the function after the function is defined: functionName (); here we can compare the source code to find that functionName is replaced by its corresponding value (expression), namely: (function () {}) (); // if no parentheses are added, the Code indicates that an anonymous function is defined and executed immediately. Let's look at another example to help us understand that when passing parameters to a function, var num = 1; functionName (num); functionName (1); parameters can be passed to variables or directly to values (expressions ), similarly, the function name can be replaced with its corresponding value (function expression ).

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.