I was trying to remove ids from a new request that have already been requested. In the code below I was expecting for the ...56 id to be removed and only the ...81 id to remain. 56 was removed but to my surprise 81 had been decreased to 80.
const oldIds = [
10032789416531456
];
const newIds = [
10032789435529381,
10032789416531456
];
const result = newIds.filter(newId => !oldIds.some(oldId => oldId === newId));
console.log(result)
//Expected result is: [10032789435529381], instead I get [10032789435529380]
I was able to solve this problem by using strings for ids instead of numbers.