function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shatrughna SalunkeShatrughna Salunke 

sort list of string including number in lightning controller

Sort the list record in JavaScript in desc orde

var number; //here we are getting dynamic number from API

var test; //here we are getting dynamic text from API

for (var i; i <= accList.length; i++) {
 
    var odlist = 'you have :' + test + number + 

  dataList.push(odlist);
}
Current output: 


1.you have : total 4 accounts of 10

2.you have : total 11 account accounts of 23 

3.you have : total 0 accounts of 100

4. you have : total 2 accounts of 6
```

Now I want to sort above list in descending order looking for output as per below:


1.you have : total 0 accounts of 100

2.you have : total 11 account accounts of 23 

3.you have : total 4 accounts of 10

4.you have : total 2 accounts of 6
 
AbhishekAbhishek (Salesforce Developers) 
https://salesforce.stackexchange.com/questions/226909/how-to-sort-a-list-of-strings-in-the-descending-order

Try the code snippet as mentioned in the above developer discussion to fulfill your requirement.


Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.