const a = [{
"iso2": "KH",
"countryName": "Cambodia",
"nationality": "Cambodian"
},
{
"iso2": "KI",
"countryName": "Kiribati",
"nationality": "I-Kiribati"
},
{
"iso2": "KM",
"countryName": "Comoros",
"nationality": "Comoran, Comorian"
},
{
"iso2": "KN",
"countryName": "Saint Kitts and Nevis",
"nationality": "Kittitian or Nevisian"
}];
i have an array from Get Api list and i intended to move isow = KN to be on top of the list to be sync with select list option. i know about push and unshift method. but is there is another easiest way to move an object in Array to be on top of the list?
splice(), which lets you insert and remove anywhere in the list. But if it's always first and last, usepush,pop,shift, andunshift.