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
1. Detect Nan
In mathematics, an arbitrary value x is always equal to itself:
x = X
However, this rule does not apply to = = = and NaN:
Copy Code code as follows:
> nan = = Nan
False
As a result, you cannot find this Nan
1. Simplify code
JavaScript defines objects and arrays very simply, and we want to create an object that is generally written like this:
Copy Code code as follows:
var car = new Object ();
Car.colour = ' red ';
Car.wheels = 4;
1, the direct creation mode. This is the simplest and most straightforward pattern, first creating an object of reference type, and then adding custom properties and methods to it. The sample code is as follows:
Copy Code code as follows:
Copy Code code as follows:
Txt1.onkeydown = function (EV) {
var oevent = ev| | Event
if (oevent.ctrlkey && oevent.keycode = 13) {
......
}
}
TXT1: The object that binds the event, for example: a text input box input.
Oevent:
Let's look at a traditional inheritance code:
Copy Code code as follows:
To define a super class
function Father () {
THIS.name = "Father";
}
Father.prototype.theSuperValue = ["NO1", "NO2"];
Defining subclasses
function
Animation principle
The so-called animation, is through the movement of some columns to form a moving picture. In the Web page, we can change the elements of the CSS value, to achieve the effect of moving.
The formula to use
Total distance S =
Entry
Kibo is not dependent on anything. All you have to do is put it in your HTML code:
Copy Code code as follows:
Download Kibo.js
Creating a Kibo object instance, the event listener is established:
Copy Code code
Cause:
Today when reading the Snandy of the Great God reading jquery (DOM element), see the ToArray () method, the specific jquery code is as follows:
Copy Code code as follows:
Toarray:function () {
Return Slice.call (this, 0);
}
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
Do you know what the following JavaScript code is going to do, and what is the value of alert?
Copy Code code as follows:
var foo = 1;
function Bar () {
if (!foo) {
var foo = 10;
}
Alert (foo);
}
Bar ();
If the
Ways to detect Browsers
1. Object feature detection method: A general method for judging browser capabilities. You can use this method if you are more concerned about the capabilities of your browser than the actual identity. This method is used to
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:
Objective
At present, unit testing is more and more valued by developers in software development, which can improve the efficiency of software development and guarantee the quality of development. In the past, unit testing is often seen in the
1.1.1 Summary
Believe that you have C + +, C # or Java programming experience, you are familiar with this keyword. Since JavaScript is an object-oriented programming language that contains the This keyword as C + +, C #, or Java, we'll introduce
Function module: Program design:
1. Can choose game time, show Countdown 1. Define Global variables
2. You can choose the number of English letters 2. Control game time function
3. Statistics score 3. Animation effect
4. Menu options 4. Set the time
This version is changed back to the form of V6, back-end data or with @ front-end to facilitate viewing and debugging. The necessity was also discussed with a TX front-end engineer yesterday. Get the variables that need to be filled out in the
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