var allProductIDs = [5410, 8362, 6638, 6758, 7795, 5775, 1004, 1008, 1013, 1014, 1015, 1072, 1076, 1086, 1111, 1112, 1140];
lastProductID = 6758;
由于某种原因,在我得到-1或我猜没有发现这个就相当于:问题的indexOf与JavaScript数组
alert(allProductIDs[allProductIDs.indexOf(lastProductID));
我想不通的生活我为什么,因为它应该找到6758,那将是索引3.如果它是索引3,那么我应该找回6758我会想。
对于它的价值,是-1表示未找到。 – Nosredna 2009-07-01 20:42:58