For debugging JavaScript programs, using Console.log () is a better approach than alert () because the alert () function blocks the execution of JavaScript programs, causing side effects; Console.log () The information is printed only in the console,
1. Simple Factory model
Description: Create a factory class that implements the creation of the implementation class for the same interface.
But it seems like JavaScript doesn't have an interface, so we remove the interface layer; Of course, the
JavaScript single Thread
A single thread of JavaScript, which is related to its purpose. As a browser scripting language, the main purpose of JavaScript is to interact with the user and manipulate the DOM. This determines that it can only be single-
There are 2 special values in JavaScript that represent information that does not exist: null and undefined. The individual believes that the difference between these two special values can be understood from the following perspectives:
1.null
First, let's look at an example:
Copy Code code as follows:
testtest
testtest
testtest
Document.forms[0] When you have a form form or multiple form forms in an HTML page, you return a form array of nodelist
Although JavaScript is an object-oriented language, its inheritance mechanism is different from the traditional object-oriented language in the first design, and is based on the prototype inheritance mechanism, but under this mechanism, inheritance
In JavaScript, string, number, and Boolean are primitive basic types, and the string, numeric, and Boolean values do not exist in the form of objects. However, because the three primitive type values need to be manipulated, JavaScript automatically
As a software development model, monomer mode has been widely used in many object-oriented languages, and the monomer mode is widely used in JavaScript, but because JavaScript language has its own unique object-oriented way, It is consistent with
The code is very concise, functional very practical, here is not much nonsense, directly to the code:
/** * Created by the Administrator on 15-1-12. */function Broswerutil () {} Broswerutil = {//Detect browser version
The example in this article describes the method for the value of JavaScript component focus and page anchor. Share to everyone for your reference. The specific analysis is as follows:
These two small features are useful in some of the newer mobile
CommentsSingle-line Comment://
Multi-line Comment:/*/
"" Multi-line comments, so this annotation method is not recommended
VariableIn a JavaScript language, the names of variables and other syntactic elements are case-sensitive. The variable
The array objects in JavaScript come with methods that you can use to manipulate the arrays.
Join ()
You can use the join () method to merge members from an array into a string:
Copy Code code as follows:
var o = [1,2,3];
This section describes how to implement a simple four-bit random number function by using a code example.A simpler way to do this is to randomly extract four characters from numbers and letters.
The code example is as follows:
function only
The examples in this article describe how JavaScript dynamically creates and deletes elements. Share to everyone for your reference. The specific analysis is as follows:
We can quickly and easily delete and delete DOM elements in the DOM, here we
The examples in this article describe the ways in which JavaScript bulk modifies file encoding formats. Share to everyone for your reference. Specifically as follows:
Summary:
Recently in the production of a manual encountered a problem ' document
Are some commonly used functions, there is no more nonsense, small partners to see their own understanding
The code:
Copy Code code as follows:
Cookies
function Setcookie (name, value, Iday)
{
if (Iday!==false)
{
var odate=new
Today, the frameworks are modular, and even the front-end JavaScript is no exception. Each module is responsible for a certain function, modules and modules are interdependent, then the question is: JavaScript how to implement dependency injection? (
This article illustrates the class and instance implementation methods in JavaScript. Share to everyone for your reference. Specifically as follows:
JavaScript does not have a parent class, the concept of subclasses, there is no class and instance
The reason for writing:
When you use JS to write functions at ordinary times, it is common to declare a function in the manner of the customary function fn () {}, and when reading some excellent plug-ins, it is unavoidable to see the creation of
Remove the space between the left and right sides of the string, you can easily use trim, LTrim, or RTrim in VBScript, but in JS there are no 3 built-in methods that need to be written manually. The following implementation method uses regular
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