I have this code, I want to do a request() for each object in an Array. I think in something like this. But it doesn't works.
var arrayLength = Temporal.length; //Temporal it's the name of the array
for (var i = 0; i < arrayLength; i++) {
var id = Temporal[i].market_hash_name;
request('http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name='+id,
function (e, r, body){
var req_data = JSON.parse(body);
var lowPrice = req_data['lowest_price'];
Temporal[i].price = lowPrice;
}
);
}
What I mean with that it doesn't work is that I would like for each market_hash_name
I would like to saving the request into the same array but in price
but I don't know how to do it, the code up is an idea
The array is this. Thanky you!
[{
"market_hash_name": "Gamma Case",
"price": "0",
}, {
"market_hash_name": "Glove Case",
"price": "0",
}, {
"market_hash_name": "Chroma 2 Case",
"price": "0"
}]