how to filter and return key-value pairs if key is not equal to "targetTime". I have tried with:
const obj = {
"name": "Rima Biswas",
"email": "rima.biswas@test.com",
"station": "Agartala",
"targetTime": { "startDate": "2022-02-01T18:30:00.000Z", "endDate": "2022-02-28T18:30:00.000Z" }
};
const entries = Object.entries(obj).filter(([key, value]) => key != "targetTime ");
console.log(entries);
>Solution :
Either
const requiredData = Object.entries(obj).filter(([key, value]) => key !== "targetTime")
Or
const {targetTime, ...restData} = obj;
const requiredData = restData;