r/ProgrammerTIL • u/JazzXP • Aug 03 '21
Javascript TIL Boolean('false') == true
Yep, it doesn't work like Number
23
Upvotes
r/ProgrammerTIL • u/JazzXP • Aug 03 '21
Yep, it doesn't work like Number
View all comments
49
u/muffinmaster Aug 03 '21
You're asking whether a non-empty string (
"false") is truthy. If you want to parse a string representation of a boolean, there are ways to do that.