From 9a7deaeab95b28bddaf5607f1b0aaa27f42c93e5 Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Mon, 1 Jul 2019 18:14:00 +0300 Subject: [PATCH] fix --- 1-js/05-data-types/03-string/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/05-data-types/03-string/article.md b/1-js/05-data-types/03-string/article.md index 45af2719..a52e1118 100644 --- a/1-js/05-data-types/03-string/article.md +++ b/1-js/05-data-types/03-string/article.md @@ -322,7 +322,7 @@ alert( ~-1 ); // 0, the same as -(-1+1) */!* ``` -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`). 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.