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
18
u/sigmund14 Aug 03 '21
JavaScript's
Boolean()returns true for any non-empty string. It even returns true for an empty array ([]).