The === equality check is a strong check. If something is truthy is does not necessarily equality-check to true.
===
Most everything in JavaScript is truthy. The 8 things that are falsy are:
false
0
""
null
undefined
-0
NaN
document.all
Things that are truthy that occasionally mess people up:var b = new Boolean(false)var a = []var o = {}
var b = new Boolean(false)
var a = []
var o = {}
Thank you for the concept! Wow. It's really concise and simple, yet can give me great bugs if not careful :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The
===
equality check is a strong check. If something is truthy is does not necessarily equality-check to true.Most everything in JavaScript is truthy. The 8 things that are falsy are:
false
0
""
null
undefined
-0
(I know, that's underhanded, but-0
is slightly different than0
)NaN
document.all
(in the HTML context)Things that are truthy that occasionally mess people up:
var b = new Boolean(false)
var a = []
var o = {}
Thank you for the concept! Wow. It's really concise and simple, yet can give me great bugs if not careful :)