1. When math is in operation
var num = + ' 123 ';
var num1 =-' 123 ';
var num2 = ' 123 '/1;
Console.log (typeof Num1)
Console.log (typeof num)
2.new operator
var num = new number (' Hello ');
Console.log (num)
3 string concatenation no matter the value of any other data type is spliced with a string, it will become a string
var ret = ' 123 ' +456;//123456
var Ret2 = ' 123 ' +{}//object? ' 123[object Object] '
var ret3 = ' 123 ' +[3,4,5]//' 1233,4,5 '
The conversion of an array into a string is a special form that translates into ' 3,4,5 '
Console.log (ret)
Console.log (Ret2)
Console.log (RET3)
Array 456 is converted to a string, followed by string concatenation with the preceding string ' 123 '
Console.log (typeof (new number). ToString ())//String data type
4 If Judgment statement
The IF (' Chuanzhi ') {//if judgment statement internally converts the value of the other data type to a Boolean data type and then determines
Console.log (' Chuanzhi ')
}
The implicit type conversion in JS