In the following code snippet, it checks for the existence of auctions[0]. If it exists, it retrieves the value and proceeds to the next number. If not, it moves on to the next number and repeats the process until it reaches number 30.
Is there a cleaner and less convoluted alternative to achieve this?
if (ahValue.auctions[0]){
var itemName = ahValue.auctions[0].item_name
var itemLore = ahValue.auctions[0].item_lore
var itemTier = ahValue.auctions[0].tier
var itemSeller = ahValue.auctions[0].auctioneer
var itemBids = ahValue.auctions[0].bids.length
console.log(`${itemName}${itemLore}${itemTier}${itemSeller}${itemBids}`)
}
// The process above repeats for indices 1 through 30