Javascript Stack Item with same name and get only highest and lowest price
Clash Royale CLAN TAG#URR8PPP
Javascript Stack Item with same name and get only highest and lowest price
In my code now, he push EVERY Item 5 times cause 5 conditions.
The Problem is, i want to show each item one time with only the Highest and Lowest Price.
Like
"Item - Price: 100000$ - 1$"
Each item is there 5 times, in different conditions and different prices.
Here is that where push that items
for(var h in ItemsCases)
if(itmID == ItemsCases[h].sku)
items.push(
name: ItemsCases[h].name,
color: ItemsCases[h].color,
rarity: ItemsCases[h].rarity,
type: ItemsCases[h].type,
image: ItemsCases[h].image,
price: parseFloat(ItemsCases[h].price/100).toFixed(2)
);
But than i get everything... but i only will show the highest and lowest price of each item name.
if(item.type == 'Factory New') ')[0] + `</div>
<div class="name2">` + item.name.replace(/ *([^)]*) */g, "").split('
The if i build with Factory New, than i get only the highest condition, but than i miss the lowest price :/
And i want to show Like Highest price - Lowest Price like $100 - $10
But now its showing only the highest...
$100 - $10
can someone help me? :/
You might need to store the
priceHigh
and priceLow
in each item, at the time of items.push
so you can use it when building HTML. Can you console.log(ItemsCases)
and post the output of first few items?– ibex
Aug 8 at 1:18
priceHigh
priceLow
items.push
console.log(ItemsCases)
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
could you post a json example of your data structure?
– Poku
Aug 7 at 20:18