DEV Community

Discussion on: JavaScript == VS === The truth

Collapse
 
jhynzar profile image
Mj Tapiru

Just to add, if you really have to check for a Truthy value, and still want to compare it to true

you can do it like this:

if (Boolean(x) === true) {
//true
}

P.S. in this case you can use Loose Comparison(==) or Strict Comparison(===). ^