How might I add check to see if a key already exists, and if does, increment the value, and if it doesn\'t exist, then set the initial value?
Something like this pseudo-
You can use the ternary operator (?:) like this:
dictionary[key] ? dictionary[key].value += 1 : dictionary[key] = {value: 1};