I have an array like [c, a, b]
. The array is dynamic, and the possible values for array are a, b, c, d, and e. And I want to sort the array in a specific order like b,d,c,a,e.
ie.
My desired output is [b, d, a]
in this case
If input is [e, b]
the output is [b, e]
like that. Is there any single method for this?