const index = arr.findIndex(n => n.id === newObj.id);
if (index !== -1) {
arr[index] = newObj;
} else {
arr.push(newObj);
}
const obj = arr.find(n => n.id === newObj.id);
if (obj) {
Object.assign(obj, newObj);
} else {
arr.push(newObj);
}
const current ={lat: "59.95", lng: "30.33"}
const newObj={lat:parseFloat(current.lat),lng:parseFloat(current.lng)}