So I'm trying to iterate through catalog items, but i'm unsuccessful, don't know what I'm doing wrong, it throws error as soon as I try to do something with catalogItems[i]. I think I found this example somewhere.
function getRandomAttributes(itemRarity, itemId) { var request = server.GetCatalogItems({CatalogVersion: null}); var catalogItems = request.Catalog; var length = catalogItems.length; var catalogItemInstance; for(var i = 0; i <= length; i++) { if(catalogItems[i].ItemId == itemId){ // It throws error here! } } }