You may have heard of memory management mechanisms for garbage collection in Java,. NET, and PHP languages, but there is little to hear about JavaScript as well as its own memory management mechanism, and JavaScript has similar garbage collection
Copy Code code as follows:
Function.prototype.heredoc = function () {
Use the annotation of a function to store the string without escaping.
var _str = this.tostring (),
S_pos = _str.indexof ("/*") +2,
E_pos = _str.lastindexof ("* *");
When you do a page, if you want to do a link click Do not do anything, or respond to click to complete other things, you can set its properties href = "#", however, this will have a problem is that when the page has a scroll bar, click will return
Once you understand the connection between a network socket and a Web server, you can send data from the browser to the server and receive the response data returned by the server.The following is the API for creating a new WebSocket object:
1. Priority-Raising
(1+2) *3 is consistent with mathematical operations, first calculated 1+2 multiplied by 3 to obtain 9
It can also be other expressions, such as:
Copy Code code as follows:
(A + (function (i) {return i} (2)) *c
An equal sign is the function of an assignment, and the main problem is the difference between two and three equals.
The difference between two equals and three equal numbers in JavaScript
Word: = = = First convert type and then compare, = = First
1. window.event
"Analysis Notes" read a piece of code first
Copy Code code as follows:
Function ET ()
{
alert (event);//ie: [Object]
}
The above code in IE run the result is [object], and in Firefox can not run.
Definition of a methodCall Method:Grammar: Fun.call (thisarg[, arg1[, arg2[, ...)]]Definition: Invokes one method of an object, replacing the current object with another object.DescriptionThe call method can be used to invoke a method instead of
You may find that there is a sentence in the code written by another person: var that = this; what does this mean?
In JavaScript, this represents the current object.
var that=this is a copy of the current this object into that variable. What's
JavaScript is the highest order of execution, unless you specifically specify that JavaScript code does not wait until the page is loaded. For example, a Web page contains the following HTML code:
Copy Code code as follows:
welcome
The first method: very useful, confirm to open the Download Address page. The principle is also quite clear. Mainly used to delete a single message confirmation.
Copy Code code as follows:
Call Method:
Copy Code code
Event states, such as the element in which the event occurred, the keyboard state, the mouse position, and the state of the mouse button. An event object is generated when an incident occurs, such as clicking a button and the corresponding event
In JavaScript, Void is an operator that specifies that you want to evaluate an expression but not return a value.
void operator usage format is as follows:
1. javascript:void (expression)
2. Javascript:void expression
Expression is an expression of
(i) Convert to string
Copy Code code as follows:
X + ""
ToString ()
String ()
A function is converted to a string that typically outputs a function body, but can override its ToString method
(ii) conversion to digital
Copy
It is easy to use timing events in JAVASCRITP, and two key methods are:
SetTimeout ()Code to execute at some point in the futureCleartimeout ()Cancel settimeout ()SetTimeout ()Grammar
Copy Code code as follows:
var t=settimeout
First, basic usage
var recognition = new Webkitspeechrecognition ();
Recognition.onresult = function (event) {
Console.log (event)
}
Recognition.start ();
This operation actually lets the user authorize the page to open the
When learning to create an array in section 7.1 of the sixth edition of the JavaScript Authority Guide by using an array direct amount, we can not assign a value to an element of an array, and it makes undefined. Although it is undefined, undefined
Three kinds of window in JS
1Alert pop-up warning no return value---------alert (' first row \ second row ');
2confirm () Select OK or cancel, return t or f----var result = confirm (' Delete! ');
3)prompt () pop-up input box, return the input
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