Detailed explanation of javascript implicit conversion

巴扎黑
Release: 2016-12-06 11:15:40
Original
1343 people have browsed it

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

      <隐式转换例子>  
Copy after login

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

      <隐式转换例子>  
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!