Add the following code to the front of the JavaScript
Copy Code code as follows:
/* @cc_on _d=document;eval (' var document=_d ') @*/
To join such a line of code IE's document access speed can be increased by at least 5 times
Copy Code code as follows:
Function F1 () {
var n = 999;
Nadd = function () {n + = 1;}
function F2 () {
alert (n);
}
return F2;
}
The closure here is F1, enclosing a variable n and a function F2.
Let's just ignore
1. Avoid using eval or function constructors
2. Avoid using with
3. Do not use try-catch-finally in functions that are critical to performance requirements
4. Avoid using global variables
5. Avoid using for-in in functions that are critical to
Below is a class that I write myself, with fields in the class, methods
Copy Code code as follows:
Constructors
function Person (name,sex,age) {
THIS.name = name;
This.sex = sex;
This.age = age;
};
such as code blocks
Copy Code code as follows:
if (true) {
int i = 100;
}
print (i); Error, variable i no declaration
As shown in the example above, a function outside of a block of code cannot access the I
In the process of writing a program, you often encounter the need to remove duplicate elements from an array. It is not difficult to implement this function.
We can do this with a double loop, and for small arrays, that's certainly not the case.
But
Insert Sort
The insertion sort is implemented in this way:
First, create an empty list to hold sorted ordered sequences (which we call "ordered lists").
Remove a number from the original series and insert it into an ordered list so that it remains
Caller:
Functionname.caller returns the caller.
Take a look at the following function, you can copy it to vs under Execute
Copy Code code as follows:
function caller () {
if (Caller.caller) {
Alert (caller.caller.toString ());
Example 1:
Copy Code code as follows:
var obj={0: ' A ', 1: ' B '}
alert (obj.length); Undefined
var arr=[' A ', ' B ']
alert (arr.length); 2
From the example above, the length property in the class array object is not
A few days ago to see a face test, the topic is this:
What do you say about Apply,call,bind in JavaScript?
It's a cliché to apply and call first, but for bind, I froze because the word was a very high frequency in jquery used to bind events to DOM
Introduced
In this article, we will discuss more details that are directly related to the execution context. The subject of the discussion is the this keyword. Practice has proved that this topic is difficult, and the determination of this in
Introduced
In this article, we will discuss more details that are directly related to the execution context. The subject of the discussion is the this keyword.
Practice has shown that this topic is difficult, and it is often problematic to determine
Objective
In this chapter, we will explain the 3rd of the S.o.l.i.d Five Principles JavaScript language implementation, the Richter replacement principle LSP (the Liskov substitution principle).
Original English:
Download Stream.js
2Kb minified
What is streams?
Streams is a simple data structure, much like an array or linked table, but with some extraordinary capabilities attached.
What's so special about them?
Unlike arrays, streams is a magical data
We call it the . It can return user IP and address, such as: var ipdata = new Array ("220.181.108.85", "", "Beijing", ""); We can use Ipdata[0] as a user IP.
But recently did not know what is going on Tencent, this address is invalid, prompted
At this time, there are encodeuricomponent, decodeuricomponent, it can completely encode the URL to decode, but encountered such as the search engine to use some of the transcoding, and touch the door, no problem, PHP official out of a solution:
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