Is something wrong with js?
if(\"hello\".indexOf(\"world\")) { // I forgot to add > -1 here
console.log(\"hello world\");
}
Basically
The only number that is "falsey" (and would therefore evaluate to false and not pass an 'if' statement) is 0. The rest are "truthy", even negative ones.
You can test this in the console with !!-1. That means converting the value to the Boolean opposite, and repeat once. The first ! on -1 returns false and the second returns true. This is the most common way to convert an expression to its Boolean equivalent.