I have a requirement to find specific record from array and move that to first position (0 index) and 0 index should move to next index and so on.
I do not want to remove or duplicate any record from array. This is what I have tried, it gives error splice is not defined
var record = data.find(x => x.CodeLovId == existingGridCellItem);
if (record !== null) {
data.remove(record)
data.splice(0, 0, record);
}
And below code duplicates records and removes existing
var record = data.find(x => x.CodeLovId == existingGridCellItem);
if (record !== null) {
data[0] = record
}
Ex -
arr1 = ['YES', 'NO', 'OK']
Item to move ['NO']
Ans - arr1 = ['NO', 'YES', 'OK']
How can I do it ?