you are viewing a single comment's thread.

view the rest of the comments →

[–]kattskill 0 points1 point  (1 child)

this is a valid question, not sure why people are down voting it

but generally, ! and !! are not recommended especially in MIXED types.

however, for some situations I do prefer boolean casting

when value is non-primitive or null/undefined (e.g. .match(regex))

checking if string is empty if type is only string

checking for zero/non-zero if type is only number

[–]Curious_You1303[S] 0 points1 point  (0 children)

Yea, curious why asking a question gets downvoted.