I have an array. I want to change the value and find it then put the change value to beginning of array
var item = {...} var items = [{id:2}, {id:2}, {id:2}];
var foundIndex = items.findIndex(x => x.id == item.id); items[foundIndex] = item;
Find it splice it unshift it.
var arr = [2, 4, 6, 8, 10];
var find = 6;
arr.unshift(arr.splice(arr.indexOf(find), 1))
console.log("" + arr)