In general, it is cleaner and simpler to omit the === true
.
However, in Javascript, those statements are different.
if (booleanValue)
will execute if booleanValue
is truthy – anything other than 0
, false
, ''
, NaN
, null
, and undefined
.
if (booleanValue === true)
will only execute if booleanValue
is precisely equal to true
.