 <p>The two relevant pieces of code that are conflicting with each other are:</p> <pre><code>removeByValue(myArray, new Date(year, month, day)); if (arr[i].begin == val) { </code></pre> <p>You are creating a brand new object and then checking if it is the same object as an object that already existed. It can't be. It's brand new.</p> <p>Instead of reference equality, if you can trust that <code>arr[i].begin</code> is a date, then you perhaps want a date comparison:</p> <pre><code>if (arr[i].begin.getTime() === val.getTime()) { </code></pre> <p>This takes both dates and converts them to an integer representation of the number of millisecond since 1970, then makes sure those integers match.</p>