Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js中的!=、== 、!==、===的用法和区别。 #15

Open
xunyhu opened this issue Sep 4, 2017 · 0 comments
Open

js中的!=、== 、!==、===的用法和区别。 #15

xunyhu opened this issue Sep 4, 2017 · 0 comments

Comments

@xunyhu
Copy link
Owner

xunyhu commented Sep 4, 2017

var num = 1;
 
var str = '1';
 
var test = 1;
 
test == num   //true 相同类型 相同值
 
test === num  //true 相同类型 相同值
 
test !== num  //false test与num类型相同,其值也相同, 非运算肯定是false
 
 
num == str   //true  把str转换为数字,检查其是否相等。
 
num != str   //false  == 的 非运算
 
num === str  //false  类型不同,直接返回false
 
num !== str  //true   num 与 str类型不同 意味着其两者不等 非运算自然是true啦



== 和 != 比较若类型不同,先偿试转换类型,再作值比较,最后返回值比较结果 。
而 
=== 和 !== 只有在相同类型下,才会比较其值。

js中的 bind()
链接一
链接二

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant