Comparison Operators
=
(Equals)
The equality operator returns Boolean true
if both operands are the same (type and value). Arrays and objects are checked for deep equality. Arrays must have the same values in the same order. Objects must have the same key/value pairs (order is not relevant). Otherwise it returns false
.
!=
(Not equals)
The inequality operator returns Boolean false
if both operands are the same (type and value, deep equality). Otherwise it returns true
.
>
(Greater than)
The 'greater than' operator returns Boolean true
if the LHS is numerically greater than the RHS. Otherwise it returns false
.
<
(Less than)
The 'less than' operator returns Boolean true
if the LHS is numerically less than the RHS. Otherwise it returns false
.
>=
(Greater than or equals)
The 'greater than or equals' operator returns Boolean true
if the LHS is numerically greater than or equal to the RHS. Otherwise it returns false
.
<=
(Less than or equals)
The 'less than or equals' operator returns Boolean true
if the LHS is numerically less than or equal to the RHS. Otherwise it returns false
.
in
(Inclusion)
The array (sequence) inclusion operator returns Boolean true
if the value of the LHS is included in the array of values on the RHS. Otherwise it returns false
. If the RHS is a single value, then it is treated as a singleton array.
Examples
"world" in ["hello", "world"]
=>true
"hello" in "hello"
=>true