我正在学习jQuery,我已经看到插件中的人使用了很多,我不知道每个人的意思。所以对每一个的解释都会非常感激。
所以这是列表,也许我输错了一些,但欢迎任何人编辑我的帖子。
==, ===, !0, !1, !=, !==
请向我解释......谢谢!
答案 0 :(得分:8)
查看这个javascript逻辑运算符列表:
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Logical_Operators
和比较运算符:
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Comparison_Operators
答案 1 :(得分:5)
Operator Description
== is equal to
=== is exactly equal to (value and type)
!= is not equal
!== is not equal (neither value nor type)
> is greater than x>8
< is less than x<8
>= is greater than or equal to
<= is less than or equal to
!0 Not 0 (could be used as not false)
!1 Not 1 (could be used as not true)
答案 2 :(得分:1)
// Comparison operators
var foo = 1;
var bar = 0;
var baz = "1";
var bim = 2;
foo == bar; // returns false
foo != bar; // returns true
foo == baz; // returns true; but note that the types are different
foo === baz; // returns false
foo !== baz; // returns true
foo === parseInt( baz ); // returns true
foo > bim; // returns false
bim > baz; // returns true
foo <= baz; // returns true
答案 3 :(得分:1)
简单地说,这些用于比较“if”语句中的2个值。它们被称为比较运算符。每个人做出不同的比较。最令人困惑的是2 =和3 =。第三个等号比较数据类型和值。除非您创建“严格”代码,否则通常不需要3rd =符号。运营商如此崩溃:
如需了解更多信息,请点击以下链接: