Javascript is a must-learn technology for web front-end development. What I will share with you today is the basic knowledge of implicit conversion of javascript. I hope it can help everyone learn better.
Convert to Boolean type false
undefined->falSe
null->falSe
numeric type 0 or 0.0 or NaN->falSe
String length is 0-> falSe
Other objects->true
<隐式转换例子>
Convert to numerical data
undefined->NaN
null->0
true->1|falSe->0
The content is a number->Number, otherwise it is converted to NaN
Other objects->NaN
<隐式转换例子>
Converted to string data
undefined->"undefined"
null->"NaN"
true->"true" falSe->"falSe"
Numeric type->NaN, 0 or a string corresponding to a numerical value
Other objects->If this object exists, it is converted to the toString() method The value of