First of all, about the JS file placement problem, if put <script> in the head tag, the browser will first load all the JS files that do not use the Defer property to render the content of the page (the browser will present the content when the body tag is encountered), If you need to load a lot of JS files, there will be a noticeable delay in rendering the page, the browser window will be blank during the delay. In order to solve this problem can be introduced at the end of the JS file, body tag before the end.
The core of JavaScript implements the standard defined by Ecamscript, and Ecamscript defines 5 simple data types: Undefined, Null, Boolean, String, number, and a complex data type object. You can use the TypeOf operator to determine the data type.
1. Undefined type:
Undefined has only one value, undefined, which is initialized by default when a variable is declared with Var but not initialized, which is the value of undefined.
2, NULL is the second only one of the special worthwhile data types is null.
3. Boolean type: For Boolean types, note whether the following types are true or false when converting to a Boolean type.
Value that converts the value of the data type to true to False
Boolean true False
String non-empty Strings "" (empty string)
Number any non-0 values 0 and nan (not a numbers)
Object NULL for any non-null object
Undefined Undefined
4. Numeric type:
4.1 The calculation of floating-point numbers is based on IEEE754, so there may be errors. Therefore, you cannot add two floating-point numbers equal to a value as a conditional expression of IF.
1 if (A + b = = 0.3) {2 alert ("hehe"); 3}
If A and B are equal to 0.1 and 0.2 respectively, then this alert statement will not execute, because this a+b = 0.3000000000001 ...
4.2 IsNaN (): (not a number) returns false as long as it is numeric or can be converted to a number.
4.3 Numerical conversions, there are three methods number (), parseint (), parsefloat ().
Number () is more complex and less common, and parseint () is commonly used when working with integers. When converting a string to a number, the Parseint method ignores the space before the string until it finds the first non-empty string, if it is not a number or minus sign, it returns NAN, and if the first is a numeric character, the second character continues to be resolved. Until all numeric characters are resolved or when non-numeric characters stop. Parseint provides an overloaded method in which the second parameter is passed into the binary that needs to be converted, and the value can be converted to the corresponding binary values.
1 var num1 = parseint ("1234blue"); 12342 var num2 = parseint ("1234blue123"); 12343 var num3 = parseint ("a1234blue123"); NaN4 var num4 = parseint (""); NaN5 var num5 = parseint (22.5); 22
6 var num = parseint ("AF", 16);
Parsefloat only parses the decimal, and does not provide an overloaded method that resolves to 8 binary.
5. String type
ToString (): Converts to a method of type string, numeric, Boolean, object, string have tostring method, null and undefined No
String (): If there is a ToString method, call the ToString method, no, NULL output "null" undefined output "undefined".
6. Type of Object
JavaScript Advanced Programming data types