js array.IndexOf not working with objects?
<p>I am trying to create an array with objects holding day and time. I am looping over a source where there may be duplicates so I want to check each time that I don't already have the current day and time stored.</p>

<p>However, I keep ending up with duplicates. So I figure the array.indexOf maybe doesn't work with objects?</p>

<pre><code>    movies.forEach(function(movie){
        if (days.indexOf(movie.day) !== -1) { //if the movie's day exists in our array of available days...
            possibleMovies.push(movie);

            //create a day/time object for this movie
            dt = {day: movie.day, time: movie.time};

            //unless we already have this day and time stored away, do so
            if (possibleTimes.indexOf(dt) === -1) {
                possibleTimes.push(dt);
            }

        }
    });
</code></pre>

<p>What possibleTimes holds after the loop is done:</p>

<pre><code>[ { day: '01', time: '18:00' },
  { day: '01', time: '16:00' },
  { day: '01', time: '18:00' },
  { day: '01', time: '16:00' } ]
</code></pre>

<p>I would expect line three and four not to be there...</p>

<p>---------- UPDATE ----------</p>

<p>I changed </p>

<pre><code>dt = {day: movie.day, time: movie.time};
</code></pre>

<p>into this</p>

<pre><code>dt = JSON.stringify({day: movie.day, time: movie.time});
</code></pre>

<p>and it works as expected. just need to JSON.parse once I retrieve the data.</p>