“===”的含义究竟是什么?在JavaScript中? [英] What is exactly the meaning of "===" in javascript?

查看:123
本文介绍了“===”的含义究竟是什么?在JavaScript中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

Javascript === vs ==

===和==之间的差异是什么?谢谢!

What's the diff between "===" and "==" ? Thanks!

推荐答案

'==='表示没有类型coersion的等式。换句话说,如果使用三等于,则值的类型也必须相等。

'===' means equality without type coersion. In other words, if using the triple equals, the values must be equal in type as well.

例如

0==false   // true
0===false  // false, because they are of a different type
1=="1"     // true, auto type coersion
1==="1"    // false, because they are of a different type

资料来源: http://longgoldenears.blogspot。 com / 2007/09 / triple-equals-in-javascript.html

这篇关于“===”的含义究竟是什么?在JavaScript中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆