I'm trying to search for an object inside an array with the following code:
function countUniqueBoxes(array,key)
{
    var output = [];
    var value = false;
    var obj = false;
    for(var i = 0; i < array.length; ++i)
    {
        value = array[i][key];
        obj = {'Box': value};
        if(output[i] === obj)
        {
            continue;
        }
        else
        {
            output.push(obj);
        }
    }
    return output;
}
The array that Is passed to this function, contains multiples objects, with duplicate values. As you can see, I Im trying to sort out the duplicates, and Insert the unique values, but Instead, ALL the values Is added to my output array, even the duplicate values.
If I do like this Instead:
 for(var i = 0; i < array.length; ++i)
    {
        value = array[i][key];
        if(output.indexOf(value) === -1)
        {
            output.push(value);
        }
    }
It works. The unique values are added to my output array. But I want add the values as objects to my array.
What Is wrong?