mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Fixed comparisons section
It was a mistake with `===` operator: `~=` is the equivalent for `==`, not `===` that is a more useful^([citation needed]) version of JS's `===`.
This commit is contained in:
parent
42a2263ab1
commit
97d15053e2
@ -135,11 +135,19 @@ funRE = //
|
||||
3 % 2 # => 1
|
||||
|
||||
|
||||
# Comparisons are mostly the same too, except that `==` and `===` are
|
||||
# inverted.
|
||||
# Comparisons are mostly the same too, except that `==` is the same as
|
||||
# JS's `===`, where JS's `==` in LiveScript is `~=`, and `===` enables
|
||||
# object and array comparisons, and also stricter comparisons:
|
||||
2 == 2 # => true
|
||||
2 == "2" # => false
|
||||
2 === "2" # => true
|
||||
2 ~= "2" # => true
|
||||
2 === "2" # => false
|
||||
|
||||
[1,2,3] == [1,2,3] # => false
|
||||
[1,2,3] === [1,2,3] # => true
|
||||
|
||||
+0 == -0 # => true
|
||||
+0 === -0 # => false
|
||||
|
||||
# Other relational operators include <, <=, > and >=
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user