Lets say my Dyanamic array is like :
var dbArray = ['Apple','Banana','Mango','Apple','Mango','Mango','Apple'];
and suppose the standard array against which i have to sort the above array is like
var stdArray = ['Mango','Apple','Banana','Grapes'];
So after sorting dbArray, my resultant array should look like :
var resultArray = ['Mango','Mango','Mango','Apple','Apple','Apple','Banana'];
As it is sorted keeping stdArray as the sorting criteria, which can be in any order regardless of alphabetical or any other standard sorting orders which are available, pure custom sorting.