Is something wrong with js?
if(\"hello\".indexOf(\"world\")) { // I forgot to add > -1 here
console.log(\"hello world\");
}
Basically
You can see Truthy and Falsy Values here
The following values are always falsy:
- false
- 0 (zero)
- "" (empty string)
- null
- undefined
- NaN (a special Number value meaning Not-a-Number!)
All other values are truthy, including "0" (zero in quotes), "false" (false in quotes), empty functions, empty arrays, and empty objects.