Let's take a look at the following three paragraphs
Code
Copy code The Code is as follows: var firstname = "mark ";
(Function displayfirstname (){
Console. Log (firstname );
}) (); // Mark output
VaR lastname = "Aut ";
(Function displaylastname (
First, let's take a look at the effect. Nothing special!
The called code is quite simple. You do not need to create other labels or span labels. The script will automatically generate the following code:
CopyCode The Code is as follows:
next,
I have been studying blue for N years. Today, I first published my own originality, because I spent a lot of time solving this problem, mainly on the Internet.
CodeIt is either very cumbersome, or not generic, or the format can only be fixed, so I
More and more people feel that there is no teaching and educating atmosphere in China. In order to understand the closure of JS, I tried to search for the closure explanation on google, when I saw this answer in stackoverflow, I came up with a
This chapter describes the data types (Basic Types and reference types), variables (including the scope of variables), and operators (mainly common, but not operators that can be understood literally ). Because "Everything is an object" in
An article on "getting started with JavaScript" covers many of the most basic content in JavaScript, from creating SCRIPT tags to using annotations, including JavaScript files in HTML documents, defining variables, using operators, defining arrays,
However, when the script is relatively long, you need to copy a large segment to the address bar, it looks very bad, and it is not easy to modify the script. Therefore, you should first write the script in a separate file, and then dynamically load
I saw an interview question a few days ago. The question is as follows:
What do you know about apply, call, and bind in javascript?
First, apply and call are common things, but for bind, I am stunned, because this word is a frequently used method in
At the beginning, many people will use the jquery selector to compare with the two APIs (I am also). The similarities and differences are actually okay, however, some people misunderstand the implementation of these two APIs in the browser,
For non-ie browsers, flash is used for implementation. The js Code is as follows:
Copy codeThe Code is as follows:
Download the flash file from here: Download
Content
Introduction
Anonymous Functions
Closure
Variable Scope
External function access to local variables in a function
Use closures to implement Private Members
Introduction
Closures are implemented using anonymous functions. A closure is a
I don't know, how do you understand the "Declaration" and "Definition" of variables in languages,
My understanding is as follows:
The "Declaration" variable is just declaration, and the "Definition" variable refers to Declaration and value
There are two annotation methods in javascript:
Single line comment ://
Multi-line comment :/**/
Annotations are mainly used to make the program we write more readable and make it easier for others to make secondary modifications.
As shown in
Chapter 2 Advanced Skills
1. Advanced functions
1.1 Scope-safe Constructor
① When you directly call the constructor rather than the new operator, because this object is bound late, it will be mapped to the Global Object window, resulting in an
Cause:
Today, when I read the top five jQuery (taking DOM elements) of snandy, I can see the toArray () method. The specific jQuery code is as follows:
Copy codeThe Code is as follows: toArray: function (){
Return slice. call (this, 0 );
},
Get:
I. js supports Unicode character sets, so you can use Chinese naming functions.
Ii. js does not have initialization variables in Var. The default value is undefined.
III. For variables that are neither declared nor assigned values, if directly used,
Today is the last part, which describes how to implement "inheritance" without using constructors ".
1. What is the inheritance of "non-constructor?For example, there is an object called "Chinese ".
Copy codeCode: var Chinese = {
Nation: 'China'
};
I just discussed a very interesting question with my colleagues. There is an idea that needs to record the user's content selected on the page. Under ff and ie9, there is a w3c dom2 event createRange, which is no longer cumbersome here. The main
I don't know how to write JS, but I will search for it. Here I found something written by someone else:
Copy codeThe Code is as follows: select (document, tanchu );
/* = Select [[
*
* Cross-browser selected text events
* @ Param
* Object o responds
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