Data type
Strings: strings are used to store a series of characters, enclosed in quotation marks, with the same effect as single and double quotes.
For example: Var a= "Bongly-ge"; var a= ' Bonly-ge '; The same effect, where Var is the definition of variable a, meaning that A is a variable, and now the value inside the string Bonly-ge,javascript can not appear in the vacuum of any one variable, it must be declared. Note: The use of quotation marks and mixed use, later there will be meaningless characters also need to declare, such as the late-stage timer will be used, the declaration of the way is Var tick; and other special declarations.
Numbers: 1 2 3 4 ..... For example: var I = 5; var j = 2; alert (I+J); can also be var i,j,k; i=5;j=2; K=i+j; Alert (k); Note: The same effect, use the latter when the variables are separated by commas, there is no "=" after the alert sign.
Boolean: Boolean value is two values, one is true (true) with a value of 1, and one is False (false) is represented by the value 0. Mainly used in the IF Judgment statement.
Arrays: Arrays are collections of numbers and strings, or they can be mixed together. There are two ways of writing, one is Var z=new Array (1, "2", ' 3 ', "AB", ' ADC '), and the other is var z = [1, "2", ' 3 ', "AB", ' ADC '), and note that the brackets are separated by commas between the elements. Each element should have its own quotation marks, even if the strings are not omitted or otherwise, it must be in strict accordance with the prescribed format. Using alert (z[1]), you can eject the corresponding element, where the contents of the parentheses inside the z[] are the subscript of the array element.
Object: Defines an object enclosed in curly braces with a name (name) and value (value) separated by commas, such as Var person{name: "bongly", Age: "$", Sex: "Male"}; Note: Value values are quoted in quotation marks, and single and double quotes are possible, but appear in pairs. There are two ways of calling, Age=person. Age Age =person[[age]; The first is commonly used, and the syntax is the variable = object. Name.
Null: null value
Undefind: Not defined
Constructor/typeof: Type, we can check the type of the corresponding element by popping the TypeOf property to determine what type it is.
Please refer to http://www.w3school.com.cn/js/js_datatypes.asp for more details.