deleted by creator
by not ever using == and !=, but only === and !==
I still don’t understand the
===
operatorEdit: I think a more type strict
==
? Pretty sure I understand the point of typescript now.So in JavaScript there’s the assignment
=
and the comparator is
==
Since there’s no types JS will do implicit conversion before comparison when using == in a case like this
if(false == '0'){ //this is true }
But with === it doesn’t. It means literally compare these
if(false === '0'){ //this is false }else{ //so this will execute instead }
But this, however, will
var someState = false; if(someState === false){ //this is true }
> 1 == 1 true > 1 == '1' true > 1 === '1' false
(from node REPL)
Basically it’s the real equals sign
The short answer is that your language needs === when it fucked up the semantics of ==, but it’s also too popular and you can’t fix it without breaking half the web.
I wish the assignment operator wasn’t the equal sign.
x 👈 5
x 🔫 5
the pew pew principle /s
Interpreter: Wait, x is 5?
This code: Always has been.