Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ea84ecf

Browse files
authored
[strings] localeCompare
1 parent 5e9eca3 commit ea84ecf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎1-js/05-data-types/03-string/article.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -538,11 +538,11 @@ Luckily, all modern browsers (IE10- requires the additional library [Intl.JS](ht
538538

539539
It provides a special method to compare strings in different languages, following their rules.
540540

541-
The call [str.localeCompare(str2)](mdn:js/String/localeCompare):
541+
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:
542542

543-
- Returns `1`if `str` is greater than `str2` according to the language rules.
544-
- Returns `-1`if `str` is less than `str2`.
545-
- Returns `0` if they are equal.
543+
- Returns a negative number if `str` is less than `str2`, i.e. `str` occurs before `str2`.
544+
- Returns a positive number if `str` is greater than`str2`, i.e. `str` occurs after `str2`.
545+
- Returns `0` if they are equivalent.
546546

547547
For instance:
548548

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /