JavaScript arrays are an ordered collection that can hold data of any type. In JavaScript, we can sort the elements of an array with the built-in method, sort() . In this article, we will learn about the sort() method with 5 important tips(or information) Hope you find them useful.
Table of contents
1. The default array.sort() is for string type2. The array.reverse() is a force fit for sorting3. The non-ASCII character sorting is easy4. Sorting an object array == Sorting on value types5. You may need the case insensitive sorting1 Comment
Sort: