I am currently developing a virtual loot box simulator and have encountered a challenging issue. My goal is to track the quantity of Normals, Legendaries, Epics, and Rares obtained by the user. However, I am facing a problem where instead of updating the count for each item category separately, it simply concatenates all scores together as text nodes. For example, if a player gets 3 normal items on their first try, it displays "Normal:3". But on the next attempt, if they get another 3 normal items, it shows "Normal:36" because it combines the scores as text nodes. Can anyone provide assistance with this dilemma?
Here is the JavaScript code snippet:
function displayBox(){
//Adding to the list
//Checking Quality and Stripping
var str = $("#item" + i).text();
console.log(str);
//Check Hero
isRunning = false;
}