We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ce41196 commit 9a7deaeCopy full SHA for 9a7deae
1-js/05-data-types/03-string/article.md
@@ -322,7 +322,7 @@ alert( ~-1 ); // 0, the same as -(-1+1)
322
*/!*
323
```
324
325
-As we can see, for 32-bit integers `~n` is zero only if `n == -1`.
+As we can see, `~n` is zero only if `n == -1` (that's for any 32-bit signed integer `n`).
326
327
So, the test `if ( ~str.indexOf("...") )` is truthy only if the result of `indexOf` is not `-1`. In other words, when there is a match.
328
0 commit comments