Skip to main content
100%

Treasure Chest

✓ Published0🌍 Public
Aangusgrant
Last edited Feb 23, 2023
Created on Feb 23, 2023

Treasure Chest is a JavaScript demonstration that uses a custom `TreasureChest` class to track quantities of gold, silver, and bronze. The page shows a simple HTML template with a heading, but all interactive behavior occurs in the browser console. Users can instantiate the class, add coins using methods like `addGold`, `addSilver`, and `addBronze`, and retrieve totals with `getLoot`. The class also includes a `getRandomLoot` static method that relies on a custom `shuffle` function to generate random coin amounts. The code uses native JavaScript object methods and property descriptors.

AI-generated description

Similar vizzes