当前位置:网站首页>js强制转换
js强制转换
2022-06-26 17:23:00 【丹丹的小跟班】
数字和其他类型数据进行比较时,会把其他类型数据转换为数字进行比较(有些数据类型,比如数组会先使用toString转换为字符串,最后再转换为数字)。
布尔值和其他数据类型进行比较时,会优先将布尔值转换为数字,然后再将其他数据类型转换为数字进行比较,也就是进行上一个规则的操作。
undefined 除了和null进行非全等比较返回true,其它均返回false。null 除了和 undefined进行非全等比较返回true,其它均返回false。
数组(或对象)和字符串进行比较时,数组(或对象)会转换成字符串再进行比较。
使用Boolean()进行转换时,如果省略或值0,-0,null,false,NaN,undefined,或空字符串(""),该对象具有的初始值false。所有其他值,包括任何对象,空数组([])或字符串"false",都会创建一个初始值为true的对象。
边栏推荐
- Demonstrate to Xiaobai the case of sub database and sub table
- Uncover the secret of Agora lipsync Technology: driving portraits to simulate human speech through real-time voice
- VSCode使用 - Remote-SSH 配置说明
- Distributed Architecture Overview
- Getting started with mongodb
- 丰富专业化产品线, 江铃福特领睿·极境版上市
- Here comes the hero League full skin Downloader
- Concurrent thread safety
- SIGIR 2022 | University of Hong Kong and others proposed the application of hypergraph comparative learning in Recommendation System
- Necessary decorator mode for 3 years' work
猜你喜欢

去中心化NFT交易协议将击败OpenSea

Teach you to learn dapr - 1 The era of net developers

MySQL add column failed because there was data before, not null by default

并发之线程安全

Concurrent thread safety

VSCode使用 - Remote-SSH 配置说明

Halcon's region: features of multiple regions (5)

丰富专业化产品线, 江铃福特领睿·极境版上市

Here comes the hero League full skin Downloader

Introduction to distributed cache / cache cluster
随机推荐
Introduction to distributed cache / cache cluster
Leetcode topic [array] -268- missing numbers
Teach you to learn dapr - 3 Run the first with dapr Net program
关于FlowUs这一款国民好笔记
Redis' 43 serial cannons, try how many you can carry
防火 疏散 自救…这场安全生产暨消防培训干货满满!
7 views on NFT market prospect
Discover K8E: minimalist kubernetes distribution
MySQL add column failed because there was data before, not null by default
Getting started with mongodb
Find out the maximum value of each column element of NxN matrix and store it in the one-dimensional array indicated by formal parameter B in order
sparksql如何通过日期返回具体周几-dayofweek函数
The texstudio official website cannot be opened
Leetcode HOT100 (22--- bracket generation)
背包问题求方案数
Leetcode daily [2022 - 02 - 16]
[qt learning notes]qt inter thread data communication and data sharing
有依赖的背包问题
Ndroid development from introduction to mastery Chapter 2: view and ViewGroup
用redis做用户访问数据统计HyperLogLog及Bitmap高级数据类型