From 97d15053e279bd247c7fd627fb857e89752a2384 Mon Sep 17 00:00:00 2001 From: Gustavo Rodrigues Date: Tue, 1 Oct 2013 09:10:27 -0300 Subject: [PATCH] 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 `===`. --- livescript.html.markdown | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/livescript.html.markdown b/livescript.html.markdown index 8e11439b..5fd61f49 100644 --- a/livescript.html.markdown +++ b/livescript.html.markdown @@ -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 >=