This article is used to record learning notes; ExtJS is a powerful JavaScript framework, if you want to really master ExtJS, then we have to have a certain understanding of JavaScript, so it is necessary to calm down, holding a JavaScript book, a bad complement. Recommended book "JavaScript Advanced Programming", "JavaScript design mode". • Here we learn about JavaScript that you may never have been exposed to, and these JavaScript knowledge is a necessary and essential knowledge to learn the framework of ExtJS. What we need to know is: –javascript data type, variable, variable operator JavaScript array –javascript function –javascript object, object-oriented –javascript prototype · JavaScript data type: JavaScript There are 6 basic types of values: number, String, Boolean, object, function, and undefined. –number: is a numeric value, including integers, decimals, NaN, plus and minus infinity. –string: The contents of a string type, single double quotation mark. –boolean:true, False–object: All JavaScript objects, not much to say –function: The familiar method, the function type, is the JavaScript-specific data type. –undefined: Indicates that the variable is declared but is not assigned a value. JavaScript variable: JavaScript declaration variable is represented by the Var keyword +name. The javascript variable is a weakly variable type, and the so-called weakly variable type actually determines the type of the variable based on the assignment. JavaScript variables are divided into global variables and local variables, all variables declared in the method are local variables, and variables declared outside the method are global variables. JavaScript operators: The JavaScript operator is basically the same as Java, and the typeof operator is a useful operator for judging data types.
An array of JavaScript
– The array is the most commonly used object in JavaScript, similar to the container in Java, can be loaded with different types of elements, the length of the container can also be arbitrary. Array manipulation is very flexible, and there are many common methods in it. –push, Pop–shift, Unshift–splice, Slice–concat, Join–sort, and REVERSE–ECMA5 also extend a number of useful methods to arrays, such as foreach, filter, some, and more. Attached chestnut code
1Ext.onready (function () {2 3 //6 types of data for number/string/boolean/object/undefined/function JavaScript4 5 //number Numeric type6 varNUM1 = 10 ;7 varNUM2 = 10.5 ;8 varnum3 =. 6;//0.69 varNUM4 = 070;//decimalTen varNUM5 = 1/0; //indicates positive Infinity One varNUM6 = Window.parseint ("Dasdsdsadsad");//NaN not a number A - //string in single-double quotation marks - //Boolean True/false the - //Object Type - varDate =NewDate (); - vararr =NewArray (); + varobj = {name: ' BJSXT ', age:10}; -Alert (Obj.hasownproperty (' name '));//determine if name is a property of obj + varresult = Obj.tosource ();//return (name: ' BJSXT ', age:10) string type AAlerttypeofresult);//String Type (name: ' BJSXT ', age:10) at //ECMA5 - - - //The Undefined variable is declared but not assigned, and is actually equivalent to NULL. - varA; -alert (a);//Undefined inalert (undefined = =NULL);//true -Alerttypeof NULL);//represents a reference to an empty object to + //Function - functionFun () { theConsole.info (' Fun ... '); * } $AlerttypeofFun);//Function TypePanax Notoginseng - //variables: Both global and local types the //JavaScript does not recommend using global variables (less efficient when looking for, and unsafe for Large program development) + varA = 10 ; A varA = ' string '; thealert (a);//' String ' +Alerttypeofa);//String Type - $ //Array $ vararr = [10, 21, 35, 32, 18]; -Arr.foreach (function(item) {//Convenience Arrays - alert (item); the }); - Wuyi varNewarr = Arr.filter (function(item) {//Filter items greater than 20 in the array to return new arrays the if(Item >20){ - return true ; Wu}Else { - return false ; About } $ }); - alert (newarr); -});
Learning can be here www.fishcmonkey.com appreciate the United States, improve the literary accomplishment