How many red, green and blue balls are in the basket?


Box type | Amount
-------- | ------
Red			 | 2
Green		 | 3
Blue.    | 3

// Like a dictionary
The above data can be represented as a dictionary or object
const boxType = {}
boxType["red"] = 2

// Alternatively, you can
[2, 3, 3] // 0, 1, 2
[red, green, blue] 

Note: If you change the order here, what will happen to the value above?

{
  key: value
} 

where value can be a number, dict, list, emoji, set

### Problem 1: 
Give a basket of 3 categories, group the balls by color.


// assume
const redObj = {}
const blueObj = {}
const greenObj = {}

const boxOfColouredBalls = [
greenObj, redObj, blueObj, redObj, blueObj, redObj, redObj, greenObj, greenObj
blueObj, redObj, greenObj
]

var red = [ {}, {}, {}, {}]
var green = [ {}, {}, {}, {}]
var blue = [ {}, {}, {}, {}]

loop boxOfColouredBalls => one box item
if type is red => add it to red box
if type is blue => add it to blue box
if type is green => add it to green box


### Problem 2:
Give a basket of N categories, group the balls by color.

const boxOfColouredBalls = [
greenObj, redObj, blueObj, redObj, blueObj, redObj, redObj, greenObj, greenObj
blueObj, redObj, greenObj, purbleObj, indigoObj,
pinkObj...all the colours available box
]

Can we create variables for N types like above?
var type1 = [];
.
.
.
var typeN = [];

// Consider using a dictionary instead
var categoryObj = {}

loop boxOfColouredBalls => one box item
  - Since the type is in item object
    - if the type exists in categoryObj
      - add value of type to container of type 
    - else // the type doesn't exist
      - create a new container for the type
      - set type value as container value

// result as a dictionary
categoryObj = {
	type1: [redObj ]
 type2: [orangeObj ]
	type3: [pinkObj]
}

// get one category
categoryObj[type1]
