-
邪恶的强制数据转换
1、常见的数据类型转换
原始值 | 转换为数字 | 转换为字符串 | 转换为布尔值 | |
false |
0 |
"false" |
false |
|
true |
1 |
"true" |
true |
|
0 |
0 |
"0" |
false |
|
1 |
1 |
"1" |
true |
|
"0" |
0 |
"0" |
true |
|
"000" |
0 |
"000" |
true |
|
"1" |
1 |
"1" |
true |
|
NaN |
NaN |
"NaN" |
false |
|
Infinity |
Infinity |
"Infinity" |
true |
|
-Infinity |
-Infinity |
"-Infinity" |
true |
|
"" |
0 |
"" |
false |
|
"20" |
20 |
"20" |
true |
|
"Runoob" |
NaN |
"Runoob" |
true |
|
[ ] |
0 |
"" |
true |
|
[20] |
20 |
"20" |
true |
|
[10,20] |
NaN |
"10,20" |
true |
|
["Runoob"] |
NaN |
"Runoob" |
true |
|
["Runoob","Google"] |
NaN |
"Runoob,Google" |
true |
|
function(){} |
NaN |
"function(){}" |
true |
|
{ } |
NaN |
"[object Object]" |
true |
|
null |
0 |
"null" |
false |
|
undefined |
NaN |
"undefined" |
false |
-
相关阅读:
玩转手工测试之客户端产品手工测试提效实践
接口测试常用工具及测试方法(新手篇)
我北漂 7 年,再也不打工了!
测试人如何高效地设计自动化测试框架?
你这样,测试人员不能活了。。。
如何优雅地记录操作日志?
C#String.IndexOf检索字符串中字符出现的次数
C#基础之数组
C#基础之is,as关键字
C#委托与事件
-
原文地址:https://www.cnblogs.com/fqlGlog/p/6550686.html
Copyright © 2020-2023
润新知