0👍
you are geting an array when you are using this
let removedElement = advantages.splice(index, 1);
let advantages = ['liked', 'sendUnlimitedLikes', 'unlockSundays', 'getBoosted', 'filters', 'revealAllProfiles', 'wholeCountry', 'exlusiveBlogs'];
let type = 'getBoosted';
let index = advantages.indexOf(type); // Find the index of the element
if (index > -1) {
let removedElement = advantages.splice(index, 1)[0]; // Remove the element and store it
advantages.unshift(removedElement); // Add the element to the start of the array
}
console.log(advantages);
Source:stackexchange.com