function checkAvailableKey(inventory,acceptedKeyList){
var i = 0;
var availableKey = new Array();
while (i <= inventory.length){
if (acceptedKeyList.indexOf(inventory[i].market_hash_name) !== -1){
availableKey.push(i);
i++;
}
else{
i++;
}
}
return availableKey;
}
try changing it to this,
function checkAvailableKey(inventory,acceptedKeyList){
var i = 0;
var availableKey = new Array();
while (i <= inventory.length){
if (acceptedKeyList.indexOf(inventory[i].market_hash_name) >= 0){
availableKey.push(i);
i++;
}
else{
i++;
}
}
return availableKey;
}