Today, I saw this very good article on the blog of rainweb.ArticleI think it is very necessary to share this article. I believe that after reading this article carefully, the understanding of JS scopes will go up to a new level.
In JavaScript,
Despite the lengthy and annoying use of Javascript in historyCodeThe period of a specific browser with a block to mark has ended, but it is still necessary to occasionally use some simple code blocks and object detection to ensure that some code
In brief, regular expressions are a powerful tool for pattern matching and replacement. The function is as follows: test a mode of a string. For example, you can test an input string to see if there is a phone number or a credit card number. This is
SetTimeout (expression, delay time) is used to execute an expression after the specified delay time after loading. The number of times is one.Setinterval (expression, interaction time) is different. It executes the expression at a specified time
Use JavaScript to get the first two digits of the float decimal point. For example, 22.127456 is used to get 22.13. How can this problem be solved?
1. the most stupid way... [How do I do it...]
1
Function
Get ()
2
{ 3 VaR
In this chapter, we will analyze Douglas crockford's implementation of JavaScript inheritance-classical inheritance in JavaScript. Crockford is Javascript developmentCommunityThe most well-known authority is the father of JSON, jslint, jsmin,
Development of web development
In the past, Web developers did not focus much on memory leaks. At that time, the relationship between pages was relatively simple, and different connection addresses were mainly used to navigate in the same site.
ArticleDirectory
A. X = A ={}, in-depth understanding of the value assignment expression
Abbreviation of If statement
& | The calculated value
Object Construction
Prototype details
Create an object and keep the prototype
I will go back to my hometown for the New Year tomorrow. I haven't finished talking about this "using inheritance in Javascript object-oriented programming" topic. If it is not completed, it will be delayed until next year. So I still have time to
Shift: Delete the first entry of the original array and return the value of the deleted element. If the array is empty, undefined is returned.VaR A = [1, 2, 3, 4, 5];VaR B = A. Shift (); // A: [2, 3, 4, 5] B: 1Unshift: add the parameter to the
The setTimeout method is a Timer Program, that is, after what time. After the job is finished, pull it down.The setInterval method indicates that an operation is executed repeatedly at a certain interval.If you use setTimeout to implement the
The quick message function is the one that you see floating on the right side. You can use it to directly submit a message and recommend it. Do you want to add this function to your blog?
Don't worry. The method is very simple. Let me talk about its
Compared with the in operator, for in traverses the prototype chain during the attributes of the loop object. for in does not read non-enumeration attributes, such as The length attribute of an array. Summary when detecting whether an object has a
In JavaScript, The hasOwnProperty function returns a Boolean value indicating whether an object has a property with a specified name.
HasOwnProperty () usage:
Object. hasOwnProperty (proName)The parameter object is required. An instance of an object.
Call () methodThe call () method is the most similar to the classic object impersonating method. Its first parameter is used as the object of this. Other parameters are directly passed to the function itself.For example:
Copy codeThe Code is as
If you use a prototype to redefine the classes in the previous example, they will become in the following form:
Copy codeThe Code is as follows: function ClassA (){
}
ClassA. prototype. color = "blue ";ClassA. prototype. sayColor = function
Declared global variables in JS are mainly divided into explicit declaration or implicit declaration.
Method 1:
Using var (keyword) + variable name (identifier) is declared outside the function, that is, global variables. Otherwise, local variables
Recently, more and more users have emphasized the interaction of the UI interface. JavaScript (JS), which is just a supporting role, has gradually become the main character for a dragon and occupies a major role.
For example, the recently popular
Document directory
Prototype inheritance
This article is also published in another independent blog Javascript: from prototype to inheritance (1)
The prototype chain of Semantic Script has always been a difficult point. This article is a
When editing content online, those JavaScript-based editors helped us a lot. These WYSIWYG editors provide us with a similar Office operation experience. Today, any website Content Management System (CMS) and blog system need such an editor. This
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