The equivalent long hand expression will be if (myValue === true)
if (myValue === true)
Wouldn't the equivalent longhand expression be if (myValue == true)? Your example will return false unless myValue is a boolean.
if (myValue == true)
myValue
Other than that, all those are great features of JavaScript.
Came to the comments to say this 😃
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.
Oh, gotcha! I assumed you were checking that it was a truthy value.
Yea I agree, that part is very misleading... its equiv to if (Boolean(myValue)) {...}
if (Boolean(myValue)) {...}
Yeah, you are right. I'll change it right away. Thanks, patrik, Blake
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.
Wouldn't the equivalent longhand expression be
if (myValue == true)
? Your example will return false unlessmyValue
is a boolean.Other than that, all those are great features of JavaScript.
Came to the comments to say this 😃
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.
Oh, gotcha! I assumed you were checking that it was a truthy value.
Yea I agree, that part is very misleading... its equiv to
if (Boolean(myValue)) {...}
Yeah, you are right. I'll change it right away. Thanks, patrik, Blake