Jump to content
McKay Development

Melonos

Member
  • Posts

    5
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Melonos reacted to adma in itemsToGive with multiple items   
    If you want to get the market hash names of each item you're giving, you would probably use forEach or a for loop to cycle through the itemsToGive array ...
    e.g
    manager.on('newOffer', function(offer) { offer.itemsToGive.forEach(function(item) { console.log("Item to give : " + item.market_hash_name); // Items to give: Chroma 2 Case }); }); a for ... of loop (edited from for..in loop)
    manager.on('newOffer', function(offer) { for (var item of offer.itemsToGive) { console.log("Items to give : " + item.market_hash_name); // Items to give: Chroma 2 Case } }); a regular for loop
    manager.on('newOffer', function(offer) { for (var i = 0; i < offer.itemsToGive.length; i++) { console.log("Items to give #" + i + " : " + offer.itemsToGive[i].market_hash_name); // Items to give #1 : Chroma 2 Case } });Same deal will apply for itemsToReceive ... or any other array you wanted to cycle through
     
    read here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration
×
×
  • Create New...