{"version":"1.0","type":"rich","title":"Data structures: Array vs Object","description":"This example contrasts array and object data structures for grouping colored balls by category. It uses plain JavaScript objects and arrays to represent a basket of balls, then demonstrates two problems: first, grouping balls into fixed red, green, and blue containers with explicit if-statements; second, scaling to an arbitrary number of categories using a dictionary (object) that dynamically creates new containers when an unseen color appears. The code shows how object keys map to category names, enabling flexible retrieval via bracket notation like `categoryObj[type]`.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-a4db424472736d222732d88274e128b8?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}