DEV Community

Discussion on: Javascript in a Ninja Way

Collapse
 
savagepixie profile image
SavagePixie

The equivalent long hand expression will be
if (myValue === true)

Wouldn't the equivalent longhand expression be if (myValue == true)? Your example will return false unless myValue is a boolean.

Other than that, all those are great features of JavaScript.

Collapse
 
blakemealey profile image
Blake Mealey

Came to the comments to say this 😃

Collapse
 
deepanmania profile image
Deepan

I assumed that it's a boolean. I was just trying to explain the truthy expressions.
I'll put appropriate comments. Thanks for the feedback.

Collapse
 
savagepixie profile image
SavagePixie

Oh, gotcha! I assumed you were checking that it was a truthy value.

Collapse
 
patricklai profile image
Patrick

Yea I agree, that part is very misleading... its equiv to if (Boolean(myValue)) {...}

Collapse
 
deepanmania profile image
Deepan • Edited

Yeah, you are right. I'll change it right away. Thanks, patrik, Blake