Move an array element from a position to another with condition

Viewed 1040

i 'm looking for a quick and robust way to move an element of an array to the top of the stack. My case is: I have an array of objects like this:

array = [{label: yu, value: uy}, {label: EUR, value: EUR}, {label: CY, value: CY}].

I want to move the element with value EUR to the top of the array so as to be the first element. How to do this?

4 Answers
Related