I have an object that looks like the example below. I want the object that is equal to the id in the variable to be sorted first. How can I do that?
const id = 15;
const obje = [
{
"name": "Join",
"phone": "1234",
"email": "test@mysite.com",
"id": "12"
},
{
"name": "Join2",
"phone": "4321",
"email": "test2@mysite.com",
"id": "15"
}
]
What I want to do is to rank the object equal to the id in the variable to the top.
Thanks for your help in advance