This article mainly introduces common type conversions and operator expressions involved in JS, including common type conversions and commonly used operator expressions in JS. Friends in need can refer to the following
Commonly used type conversions in JS (usually forced conversion):
1. Forced conversion to integer: parseInt; writing method: x = parseInt(x );
2. The forced conversion bit is: parseFloat; writing method: x = parseFloat(x);
3. Detection type: x = parseInt(x); alert(typeof(true));
Commonly used operator expressions in JS:
1. Logical operators (Boolean): && and;|| or;! Not ;
2. Comparison operator: == (equal to) ;! = (not equal to); >; <;>= (greater than or equal to); Remainder); +=; +-;
4. Other operators: concatenation of strings (numbers and strings);
For example:
var s1 = "hello" ;Value 1; Value 2; For example: a==b?"A equals B":"A is not equal to B";The above is the detailed content of Detailed explanation of examples of common type conversions in JS. For more information, please follow other related articles on the PHP Chinese website!