var array1 = ["ddd","aaa","eee","aaa","fff","bbb","ggg","aaa","ccc","fff"]
i have to arrange it in a way that identical values has to be placed together
output array should be
["ddd","aaa","aaa","aaa","eee","fff","fff","bbb","ggg","ccc"]
how to write the logic for this one ??