I'm pretty new to JS but I want to make a very basic RPG item generator that is controlled by probability. This is what I have come up with.

I have a problem with the itemtype part. After the probability roll is done for itemtype, I want to randomly generate a group of elements under weapons, accessories, and armors.

It should be something like Rare Sword, Uncommon staff, Common gloves, or Common Chest.

...