2016-10-13 00:16:48 点击量:78 标签: 收藏本文
[js]说说js中的“==”与布尔值,关于"=="的比较规则:
1. Comparing numbers and strings will always convert the strings to numbers.
number类型与string类型比较,string会转换为number类型。如:2=="2" true
2. null and undefined will always equal each other.
null类型与undefined类型比较始终相等。如:var a = null,b; 则 a==b 为true。
3. Comparing booleans to any other type will always cause the booleans to be converted to numbers.
布尔类型与其他任何类型进行比较,布尔类型将会转换为number类型。如:var a = 0, b = false;则a==b为true
4. Comparing numbers or strings to objects will always cause the numbers or strings to be converted to objects.
number类型或者string类型与object类型进行比较,number或者string类型都会转换为object类型。如:var a = 0, b = {};则a==b为false
我们是一家提供综合软件外包与弱电工程服务的技术公司。
业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。
公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室