We know that the operators that detect object types in JavaScript are: typeof, Instanceof, and the constructor properties of objects:
1) The typeof operator TypeOf is a unary operator, and the return result is a string indicating the type of the
Let's remember a word: this always points to the object where the function is running! Instead of the object where the function was created. Remember...
This article will be divided into three different scenarios to analyze where the this object is.
The code is very simple, directly on the code, you can copy the following code saved into an HTML file to run look at the effect
Copy Code code as follows:
11111
Operation of an array
1, the creation of the array
Copy Code code as follows:
var arrayobj = new Array (); Create an array
var arrayobj = new Array ([size]); Create an array and specify the length, note not the upper limit, is the
First, constructorThe value of the constructor is a function. In JavaScript, values, arrays, functions, and objects, except null and undefined, have a constructor property, and the value of the constructor property is the constructor of that value,
In JavaScript, to judge the type of a variable to try the typeof operator, it is a problem to store a value using a reference type when using the TypeOf operator, regardless of what type of object is referenced, it returns "Object". This requires
Under global scope
ThisWhen this is used in the global scope, it points to the global object.Here is a detailed description of the global object:
A global object is an object that has been created before any execution context is entered;This
Javascript is the only widely used, prototype-inherited language, so it takes time to understand the differences between the two ways of inheriting.
The first major difference is that Javascript uses a prototype chain to inherit:
function
Copy Code code as follows:
The above example creates a handler object, and the Handler.handlerfun () method is assigned to the Click event handler of the DOM button. The design intent is this: when the button is clicked to trigger
============== about the display and hiding of elements =============
Visibility faster than display
There are 2 ways to create interesting effects by making pictures come and go: using the Visibility property of CSS or
Display property. For
As shown below:
javascript Calculated value
Assume y=5, Compute x=y+2, and display results .
click here
The above is small set for everyone to bring the JavaScript calculation value and then embed the value into the
One, what is argumentsArguments is a built-in object in JavaScript, it's quirky and often overlooked, but it's really important. All the major JS libraries use the arguments object. So agruments objects must be familiar to JavaScript programmers.All
Because these two years HTML5 fire's positive heat, therefore studied a bit, recently had an idea also to use the related function which the HTML, therefore also must study well.
Take a good look at the function of canvas, feel HTML5 in the client
This article mainly introduces lazy loading and preload two technology analysis, nonsense not to say, together to see.
lazy loading is also called delay loading: The previous article has introduced: JS pictures delay loading pictures or certain
Copy Code code as follows:
/**
* Date of format
* @param {Object} MS represents the number of milliseconds between the specified date and the global standard Time between midnight and January 1, 1970
* @return Year-month-date hh:mm
*/
Util.
All variables in JavaScript are objects except for two exceptions null and undefined.
Copy Code code as follows:
False.tostring (); ' False '
[1, 2, 3].tostring (); ' 1,2,3 '
function Foo () {}
Foo.bar = 1;
Foo.bar; 1
As you may know, the execution environment for a JavaScript language is "single-threaded" (single thread).The so-called "single thread" means that only one task can be completed at a time. If you have more than one task, you must queue, the previous
In December 2009, ECMAScript released ECMAScript 5, which is 10 years from the previous version of the ECMAScript 3 standard, which, while JavaScript is great for Web programming, ECMAScript 4 but ultimately because of the interests of the major
The working principle of this
If a function is invoked as a method of an object, then this will be assigned as the object.
Copy Code code as follows:
var parent = {
Method:function () {
Console.log (this);
}
};
Recently collected some methods about JavaScript binding events, summarized, not comprehensive, but, I hope to facilitate the future to see for themselves.
There are three main ways to bind events in javascript:
1 binding directly in a DOM element
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.