I’m not sure if the title of this question is correct or not, and also don’t know which suitable keyword to search in google.
My array looks like this:
var myArray = [1,1,2,2,2,3,4,4,4];
and I want to sort the array into:
var myArray = [1,2,3,4,1,2,4,2,4];
Please, to my expected result. the order increases, but the repeated value is repeated in the last sequence, and does not stack together in adjacent keys. Thus, the expected result is grouped as 1,2,3,4 1,2,4and 2,4.
Thanks for your help and sorry for my bad english.