Javascript learning 2-javascript FAQs

Source: Internet
Author: User
1. Javascript Chinese and variables are case-sensitive. 2. There are no special differences between single quotes and double quotes in Javascript. They can be used to create strings. But as a general rule, most developers prefer to use single quotes instead of double quotes, but the XHTML specification requires that all attribute values must be... syntaxHighlighter. all (); 1. Javascript Chinese and variables are case-sensitive. 2. There are no special differences between single quotes and double quotes in Javascript. They can be used to create strings. However, as a general rule, most developers prefer to use single quotes instead of double quotes, but the XHTML specification requires that all attribute values be enclosed in double quotes. In this way, the single quotation marks are used in JS, and the use of double quotation marks on XHTML makes the code of the two more convenient and clearer. Single quotes can contain double quotes. Likewise, double quotes can also contain single quotes. 3. Brackets first need to be noted: JS brackets contain two types of semantics, which can be a separator or expression. A. separators are very familiar to everyone (1 + 3) * 3 equals 12 B, (function () {}) (); a pair of parentheses before function is used as separators, the parentheses below indicate that this method is executed immediately. 4. function call and reference because parentheses represent execution, var foo = example (); foo indicates the return value of the function var foo1 = example; assign a function reference to a value of foo1 5. Overloading JS does not support overloading, therefore, here there is a reload, which is more similar to replacing JS with no different number of parameters. 6. Scope and closure scope refer to the code space with access permissions for a certain attribute or method. For example, function myFunction () {var temp = "abc";} the temp above cannot be accessed outside the function. A closure is a concept related to the scope. It refers to the attributes of an internal function even after the external function is executed and terminated. Here is an example of the scope and closure: we create the following html page: [html] Untitled document
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.