Is there a more efficient method to sort a table than the current solution that is working flawlessly? My objective is to reposition an element at index 0 if its value is equal to "xx";
const countries= [
{label: "Germany", value: "DE"},
{label: "France", value: "FR"},
{label: "Spain", value: "ES"},
];
countries.forEach(element => {
if (element.value === "FR") {
const france = element;
countries.splice(countries.indexOf(element), 1)
countries.unshift(france);
}
})