var arrayEngineSizes = new Array();
array1.forEach(function(entry) {
if (entry.model == y)
{
var loc = $.inArray(entry.enginesize, arrayEngineSizes);
alert(loc);
if (loc == -1) // supposedly prevents duplicates, but not really, always says -1
//arrayEngineSizes.push(entry.enginesize);
{
arrayEngineSizes.push(entry);
alert('pushed value containing ' + entry.enginesize);
//loc = arrayEngineSizes.indexOf(entry.enginesize);
loc = $.inArray(entry.enginesize, arrayEngineSizes);
alert('what does loc say now? ' + loc); // always says -1
}
}
Yes, I don't know how to use the forum code box. I can never escape from it once I get in it.
Anyway, why can't I find and avoid duplicates using the code above, other than the code being bogus?