I cannot figure out why I keep getting -1 for lastProductIndex when clearly the lastProductID is in the array!
var lastProductID = 6758;
var allProductIDs =
This confused me too at first, I had an identical problem. It seems jQuery.inArray() requires a string. So you could just do:
var lastProductID = "6758";
In my case I was trying to do:
var foo = date.getTime()/1000;
Which always resulted in -1 being returned from $.inArray()
But you can just cast it to a string:
var foo = String(date.getTime()/1000);
Hope that helps somebody :)