Common type conversion in JS (usually cast):
1. Force conversion to integer: parseInt; writing method:x = parseInt(x);
2. The cast bit is small: parseFloat; writing method:x = parseFloat(x);
3. Detection type:x = parseInt(x); alert(typeof(true));
Common operator expressions in JS:
1. Logical operator (boolean): && and ;|| or ;! No ;
2. Comparison operator: == (equal to);! =(not equal to); > ; < ; >=(greater than or equal to); <=(less than or equal to);
3. Mathematical operators: + ; - ; * ; / ; % (take the remainder); += ; +- ;
4. Other operators: string splicing (numbers and strings);
For example:var s1 = "hello";
var s2 = "lucy";
Triple operator: var x = judgment condition? Value 1; Value 2; For example: a==b?"A equals B":"A does not equal B";
The above is a brief analysis of commonly used type conversions and operator expressions in JS that the editor briefly introduces to you. I hope it will be helpful to you. If you have any questions, please leave a message. The editor will reply to you in time!