From ea84ecf5157b28c75690079a700d58a60512f151 Mon Sep 17 00:00:00 2001 From: aruseni Date: Mon, 8 Jul 2019 02:20:30 +0300 Subject: [PATCH] [strings] localeCompare --- 1-js/05-data-types/03-string/article.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/1-js/05-data-types/03-string/article.md b/1-js/05-data-types/03-string/article.md index a85316b5..439f7995 100644 --- a/1-js/05-data-types/03-string/article.md +++ b/1-js/05-data-types/03-string/article.md @@ -538,11 +538,11 @@ Luckily, all modern browsers (IE10- requires the additional library [Intl.JS](ht It provides a special method to compare strings in different languages, following their rules. -The call [str.localeCompare(str2)](mdn:js/String/localeCompare): +The call [str.localeCompare(str2)](mdn:js/String/localeCompare) returns an integer indicating whether `str` comes before, after or is equivalent to `str2` according to the language rules: -- Returns `1` if `str` is greater than `str2` according to the language rules. -- Returns `-1` if `str` is less than `str2`. -- Returns `0` if they are equal. +- Returns a negative number if `str` is less than `str2`, i.e. `str` occurs before `str2`. +- Returns a positive number if `str` is greater than `str2`, i.e. `str` occurs after `str2`. +- Returns `0` if they are equivalent. For instance: