### Classes

TypedDict

# Methods

#### # inner clear()

Removes all previously stored key-value pairs from the Dictionary.

##### Example

    function setup() {
      let myDictionary = createStringDict('p5', 'js');
      print(myDictionary.hasKey('p5')); // prints 'true'
      myDictionary.clear();
      print(myDictionary.hasKey('p5')); // prints 'false'
    }

#### # inner create(key, value)

Creates a new key-value pair in the Dictionary.

##### Parameters:

Name | Type | Description
--- | --- | ---
`key` | Number | String |
`value` | Number | String |

##### Example

    function setup() {
      let myDictionary = createStringDict('p5', 'js');
      myDictionary.create('happy', 'coding');
      myDictionary.print();
      // above logs "key: p5 - value: js, key: happy - value: coding" to console
    }

#### # inner get(the) → {Number|String}

Returns the value stored at the given key.

##### Parameters:

Name | Type | Description
--- | --- | ---
`the` | Number | String | key you want to access

Returns:
the value stored at that key
Type: Number | String

##### Example

    function setup() {
      let myDictionary = createStringDict('p5', 'js');
      let myValue = myDictionary.get('p5');
      print(myValue === 'js'); // logs true to console
    }

#### # inner hasKey(key) → {Boolean}

Returns true if the given key exists in the Dictionary, otherwise returns false.

##### Parameters:

Name | Type | Description
--- | --- | ---
`key` | Number | String | that you want to look up

Returns:
whether that key exists in Dictionary
Type: Boolean

##### Example

    function setup() {
      let myDictionary = createStringDict('p5', 'js');
      print(myDictionary.hasKey('p5')); // logs true to console
    }

#### # inner print()

Logs the set of items currently stored in the Dictionary to the console.

##### Example

    function setup() {
      let myDictionary = createStringDict('p5', 'js');
      myDictionary.create('happy', 'coding');
      myDictionary.print();
      // above logs "key: p5 - value: js, key: happy - value: coding" to console
    }

#### # inner remove(key)

Removes the key-value pair stored at the given key from the Dictionary.

##### Parameters:

Name | Type | Description
--- | --- | ---
`key` | Number | String | for the pair to remove

##### Example

    function setup() {
      let myDictionary = createStringDict('p5', 'js');
      myDictionary.create('happy', 'coding');
      myDictionary.print();
      // above logs "key: p5 - value: js, key: happy - value: coding" to console
      myDictionary.remove('p5');
      myDictionary.print();
      // above logs "key: happy value: coding" to console
    }

#### # inner saveJSON()

Converts the Dictionary into a JSON file for local download.

##### Example

    function setup() {
      createCanvas(100, 100);
      background(200);
      text('click here to save', 10, 10, 70, 80);
    }

    function mousePressed() {
      if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
        createStringDict({
          john: 1940,
          paul: 1942,
          george: 1943,
          ringo: 1940
        }).saveJSON('beatles');
      }
    }

#### # inner set(key, value)

Updates the value associated with the given key in case it already exists in the Dictionary. Otherwise a new key-value pair is added.

##### Parameters:

Name | Type | Description
--- | --- | ---
`key` | Number | String |
`value` | Number | String |

##### Example

    function setup() {
      let myDictionary = createStringDict('p5', 'js');
      myDictionary.set('p5', 'JS');
      myDictionary.print(); // logs "key: p5 - value: JS" to console
    }

#### # inner size() → {Integer}

Returns the number of key-value pairs currently stored in the Dictionary.

Returns:
the number of key-value pairs in the Dictionary
Type: Integer

##### Example

    function setup() {
      let myDictionary = createNumberDict(1, 10);
      myDictionary.create(2, 20);
      myDictionary.create(3, 30);
      print(myDictionary.size()); // logs 3 to the console
    }