### Similar Reads

How to move Null Values at the end Regardless of the Sorting Direction in TypeScript ? A few times, we face situations where we need to sort values with null values in them. In this, we sort it and move the null values to the end regardless of the sorting direction. In TypeScript, achieving this requires special handling and sowe are going to discuss those processes. These are the following ways: Table of Content Using custom Sorting 2 min read How to Make a Generic Sorting Function in TypeScript ? Sorting is a fundamental operation in programming, allowing us to organize data in a specific order for easier manipulation and retrieval. In TypeScript, creating a generic sorting function provides flexibility and reusability across different data types. Table of Content Using Array.prototype.sort() methodBy creating custom sorting logicUsing Arra 4 min read Difference between sorting string array and numerical array The array.sort() method sorts the string array in alphabetical order. This method sorts string arrays based on Unicode(). Unicode provides a unique number for every character, no matter what platform, device, application, or language. This allows every modern system to use Unicode. These should be started with uppercase and lowercase letters. Synta 3 min read How to sorting an array without using loops in Node.js ? The setInterval() method repeats or re-schedules the given function at every given time-interval. It is somewhat like window.setInterval() Method of JavaScript API, however, a string of code can't be passed to get it executed. Syntax: setInterval(timerFunction, millisecondsTime); Parameter: It accepts two parameters which are mentioned above and de 2 min read Javascript Program For Sorting An Array Of 0s, 1s and 2s Given an array A[] consisting 0s, 1s and 2s. The task is to write a function that sorts the given array. The functions should put all 0s first, then all 1s and all 2s in last.Examples: Input: {0, 1, 2, 0, 1, 2} Output: {0, 0, 1, 1, 2, 2} Input: {0, 1, 1, 0, 1, 2, 1, 2, 0, 0, 0, 1} Output: {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2} Recommended: Please sol 5 min read Sorting an Array of Binary Values using JavaScript JavaScript allows us to sort an array containing only binary values i.e. 0 and 1, below is an example to understand the problem. Example: Input array = [ 0 , 1, 0, 0 , 0, 1, 0 , 1, 0 , 1, 1]Output array = [ 0 , 0 , 0 , 0 , 0, 0 , 1 , 1, 1, 1]Below are several approaches to sorting an array of binary values using JavaScript which are as follows: Tab 2 min read Sorting Array of Exactly Three Unique Repeating Elements in JavaScript Given an array of Numbers that contain any frequency of exactly three unique elements. Our task is to sort this array using JavaScript. Examples: Input: arr[] = [3, 1, 3, 2, 1, 2, 1, 3, 2]Output: [1, 1, 1, 2, 2, 2,3,3,3]Input = arr[] =[1,2,3,1,2,3]Output: [1,1,2,2,3,3]Table of Content Counting Sort with Extra SpaceThree-Way PartitioningCounting Sor 2 min read Count Unique Elements in Array Without Sorting using JavaScript One can count unique elements(distinct elements) present in an array without sorting JavaScript. There are several methods of counting unique elements without sorting in JavaScript. Below is an example to understand the problem clearly. Example:Input: [ 1,2, 3, 1, 3, 4, 5, 5, 2] Output: 5 Explanation: Unique Elements in array : 1, 2, 3, 4, 5. Total 3 min read Sorting Array of Number by Increasing Frequency using JavaScript To sort an array of given numbers based on the frequency of occurrence of each number first sort the array such that the elements repeated for the least number of times appear first followed by the elements with increasing frequency. Example: Input:array = [3, 3, 1, 1, 1, 8, 3, 6, 8, 8] Output:[6, 1, 1, 1, 3, 3, 3, 8, 8, 8]Explanation:Number 6 occu 3 min read Alternative Sorting of an Array using JavaScript Alternative sorting means we have to arrange the elements of an array in such a way that the first element is the first maximum and the second element is the first minimum, the third element is the second maximum, the fourth element is the second minimum, and so on. Example: Input: array = [5, 6, 2, 4, 3, 1]Output: array = [6, 1, 5, 2, 4, 3] Explan 3 min read