vendredi 15 septembre 2023

How to loop on array or objects then getting a random value

If my set up is like this:

const arr = [
    { name: "hi", value: "hello", rarity: "50%" }
    { name: "hello", value: "40%"}
]

How can I loop through it and get a random value based on their rarities?

I tried possible things I know. Didn't work out somehow.




Aucun commentaire:

Enregistrer un commentaire