MDN | MDN Curriculum | Playground | HTTP Observatory | About MDN | Advertise with us | Community | Blog | MDN Plus | MDN Discord | HTML: Markup language | Elements | Global attributes | Attributes | See all… | Responsive images | HTML cheatsheet | Date & time formats | See all… | SVG | MathML | XML | CSS: Styling language | Properties | Selectors | At-rules | Values | See all…
Tin mới
JavaScript: Scripting language
Web APIs: Programming interfaces
Structuring content with HTML module
Dynamic scripting with JavaScript module
For sorting strings with non-ASCII characters, i.e., strings with accented characters (e, é, è, a, ä, etc.), strings from languages other than English, use String.prototype.localeCompare(). This function can compare thos
String.prototype.localeCompare()
For sorting strings with non-ASCII characters, i.e., strings with accented characters (e, é, è, a, ä, etc.), strings from languages other than English, use String.prototype.localeCompare(). This function can compare thos
sort() returns the reference to the same array
The sort() method returns a reference to the original array, so mutating the returned array will mutate the original array as well.
sort() returns the reference to the same array
The sort() method returns a reference to the original array, so mutating the returned array will mutate the original array as well.
sort() returns the reference to the same array
The sort() method returns a reference to the original array, so mutating the returned array will mutate the original array as well.
sort() returns the reference to the same array
The sort() method returns a reference to the original array, so mutating the returned array will mutate the original array as well.
sort() returns the reference to the same array
The sort() method returns a reference to the original array, so mutating the returned array will mutate the original array as well.
Calling sort() on non-array objects
The sort() method reads the length property of this. It then collects all existing integer-keyed properties in the range of 0 to length - 1, sorts them, and writes them back. If there are missing properties in the range,
This page was last modified on Jul 20, 2025 by MDN contributors.