Native JavaScript traversal 1, for loop traversal1 Let array1 = [' A ', ' B ', ' C ']; 2 3 for (Let i = 0;i ) {4 console.log (Array1[i]); // a b 5 }2. JavaScript provides a foreach () map () Two ways to iterate over an array objectThe foreach
There are 6 types of data in ECMAScript, including 5 basic data Types (undefined,null,boolean,number,string) and a complex data type (Object). "ES6 adds a more symbol data type, but it's not a discussion here first."Undefined typeThe undefined type
The 1.javascript engine works by parsing the code, getting all the declared variables, and then running on one line, which results in the declaration of all variables being promoted to the head of the code, which is called the elevation of the
One, "no block-level scope in JavaScript"There are block-level scopes in Java and C #, which is: curly braces are also a scopevoid Main () { if(1==1) { = "Seven"; } SYSTEM.OUT.PRINTLN (name);} // ErrorJavavoid Main () { if(1==1) {
1. Convert a string to a variable name[JavaScript]View PlainCopyPrint?
function string_to_name (String) {
let _name = ' var new_name= ' +STRING;
eval (_name);
return _name;
}
2. Convert a string to a
Directory
The concept of closures
Talking about function execution environment, scope chain and variable object
Closures and Function currying
Extra memory footprint due to closures (note I'm not talking about "memory leaks"!) )
First, constructor inheritance The simplest approach is to use the call or Apply method to bind the parent object's constructor to the child object.functionParent (name) { This. Name =name; This. color = [' red ', ' green ']; This. GetInfo
Identifiers undefined do not really reflect "undefined" because undefined is not a JavaScript reserved wordJavaScript provides an void operator that evaluates the specified expression and returns the trusted undefined :void expression It is obtained
? far greater than symbolsIn the mathematical formula, ">>" stands for greater than the symbol, indicating that one number is much larger than another, such as 76>>3,-2>>-99. Poincaré and Borel first used it in 1901, and was soon accepted by the
First ,JavaScript introduction1. What is JavaScript?JavaScript is a literal-translation scripting language, which is a dynamic type, a weak type, a prototype-based language, and a built-in support type. Its interpreter, known as the JavaScript
Use JavaScript to do intermittent scrolling of textCONST INIT = (InitData) ={Const area=Initdata.area;//sets the height of the single-line scrolling;Const Ilineheight = initdata.ilineheight? Initdata.ilineheight:24;//set the speed of scrolling;Const
closures (closure) are a difficult and unique feature of the JavaScript language, and many advanced applications rely on closures. Here is my study note, which should be useful for JavaScript beginners.The scope of a variableTo understand closures,
1. Arraysvar arr = array ();Can specify the number, or do not specify, or directly fill in the parameters using "," separatedor use the [] declaration directly, var arr = ["Nane", 0,false]And you can do that.arr["name"] = 0; Actually more like the
Object, which is a very important stem in JavaScript, is a good understanding of how it is directly related to your basic understanding of the entire JavaScript system, which is, in plain parlance, a group of objects. Beep )。Several common types of
Null has no property value and cannot get its entity (existence) value. So Null.property returns an error instead of a undefined.Consider the following codeif (Node.nextSibling.className = = ...) {...}If node or node.nextsibling is empty (null), an
How to write the css series button and cssbutton
In the development of the modern front-end industry, if you haven't used some pre-compilation tools while using css, do you think you are too low. But have you considered building your own front-end
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