1. typeof operator: Determines what type an object is, returns ""
First, Number type
1, JavaScript is not good at calculation, can not be used for floating-point calculation. such as: var a = 0.2; var B = 0.1; -A + b = 0.3000000000000004
2, Nan means non-numeric
3. Number: Convert objects to numbers
4. parseint: Resolves an object to an integer
5. parsefloat: Resolves the object to a floating-point number
%%%%%%%%%%%% Here are a few things to keep in mind
6. Strings with a length greater than 0 are true
7, 0 is False
8, Nan non-digit is false
9, empty string is False
10. Numbers greater than or equal to 1 are true
Two, String type
1. String: Casts the object to a string type
Switch (case)
1, compared to the C # switch (case), JS in the switch (case) can be run through, that is, a case can not break
2, can be directly behind the switch case without prior declaration
The relationship between numbers and strings in JS
1, the string in JS is a value type
2, JS in the + number has the function of the connection string:
var num1 = 5;var num2 = 10;
var result1 = num1 + "5"; -RESULT1 = 55 (numeric + string)
"The sum of 5 and Ten is" + NUM1 + num2; -"The sum of 5 and is 510"
"The sum of 5 and Ten is" + (NUM1 + num2); -"The sum of 5 and is 15" (shown to do the number calculation) and compare above
3. Logical judgment of String (Boolean)
The ternary operation in JS
The special case of the division parameter in JS (Infinity Infinity)
alert (5/nan); NaN
alert (infinity/infinity); Nan Non-numeric
alert (INFINITY/2); Infinity Infinity
alert (5/0); Infinity
alert (10/true); Ten true is essentially 1
alert (10/false); Infinity false
The equal operation in the six, JS
1, "= = =" means congruent, requires not only equal value, the same type. Special case: Alert ("+")-"true" because there will be conversions between them but alert (55 = = = "55"); -"false" (number type and string type)
About JavaScript (scripting language)