p5.js TypedDict print() Method Last Updated : 27 Nov, 2020 Comments Improve Suggest changes Like Article Like Report The print() method of p5.TypedDict in p5.js is used to print out all the key-value pairs currently present in the dictionary to the console. A key-value pair is a set of two values that are mapped to each other. These values can be accessed by querying this dictionary using the key portion of the pair. A typed dictionary can store multiple key-value pairs that can be accessed using the methods of the dictionary. Syntax: print() Parameters: This method does not accept any parameters. The example below illustrates the print() method in p5.js: Example: JavaScript function setup() { createCanvas(550, 300); textSize(16); let stringDict = createStringDict("Tokyo", "37.26 million"); text("New string dictionary created " + "with one key", 20, 20); // Getting the current size of the dictionary let currSize = stringDict.size(); print("Printing " + currSize + " key-value pair(s):"); // Printing all the values to console stringDict.print(); text("Dictionary keys printed to console", 20, 60); let tmpObj = { "Delhi": "25.87 million", "Shanghai": "23.48 million", "Mexico City": "21.34 million" }; // Add the given key to the dictionary // specifying the key and value as an object stringDict.create(tmpObj); text("New keys added to the dictionary", 20, 100); // Getting the current size of the dictionary currSize = stringDict.size(); print("Printing " + currSize + " key-value pair(s):"); // Printing all the values to console stringDict.print(); text("Dictionary keys printed to console", 20, 140); } Output: Online editor: https://editor.p5js.org/Environment Setup: https://www.geeksforgeeks.org/p5-js-soundfile-object-installation-and-methods/Reference: https://p5js.org/reference/#/p5.TypedDict/print Comment More infoAdvertise with us Next Article p5.js TypedDict print() Method sayantanm19 Follow Improve Article Tags : JavaScript Web Technologies JavaScript-p5.js Similar Reads p5.js TypedDict set() Method The set() method of p5.TypedDict in p5.js is used to add or modify the value at the given key of the dictionary. A key-value pair is a set of two values that are mapped to each other. These values can be accessed by querying this dictionary using the key portion of the pair. A typed dictionary can s 2 min read p5.js TypedDict size() Method The size() method of p5.TypedDict in p5.js is used to get the current size of the dictionary. The size represents the number of key-value pairs currently present in the dictionary. A key-value pair is a set of two values that are mapped to each other. These values can be accessed by querying this di 2 min read p5.js TypedDict remove() Method The remove() method of p5.TypedDict in p5.js is used to remove the given key-value pair from the typed dictionary. A key-value pair is a set of two values that are mapped to each other. These values can be accessed by querying this dictionary using the key portion of the pair. A typed dictionary can 2 min read p5.js TypedDict get() Method The get() method of p5.TypedDict in p5.js is used to return the value at the given key of the dictionary. The method returns undefined if the key does not exist in the dictionary. A key-value pair is a set of two values that are mapped to each other. These values can be accessed by querying this dic 2 min read p5.js TypedDict clear() Method The clear() method of p5.TypedDict in p5.js is used to remove all the key-value pairs in the typed dictionary. A key-value pair is a set of two values that are mapped to each other. These values can be accessed by querying this dictionary using the key portion of the pair. A typed dictionary can sto 2 min read p5.js TypedDict create() Method The create() method of p5.TypedDict in p5.js is used to add the given key-value pair or collection of pairs to the dictionary. A key-value pair is a set of two values that are mapped to each other. These values can be accessed by querying this dictionary using the key portion of the pair. A dictiona 3 min read p5.js TypedDict hasKey() Method The hasKey() method of p5.TypedDict in p5.js is used to check if the given key exists in the typed dictionary. This method returns true if the given key exists, else it returns false. A key-value pair is a set of two values that are mapped to each other. These values can be accessed by querying this 3 min read p5.js NumberDict minKey() Method The minKey() method of p5.NumberDict in p5.js is used to find the lowest value of key in a number dictionary. A key-value pair is a set of two values that are mapped to each other. These values can be accessed by querying this dictionary using the key portion of the pair. A number dictionary can sto 3 min read p5.js NumberDict mult() Method The mult() method of p5.NumberDict in p5.js multiplies the given value to the value at the given key and stores the updated value at the same key. A key-value pair is a set of two values that are mapped to each other. These values can be accessed by querying this dictionary using the key portion of 3 min read p5.js NumberDict minValue() Method The minValue() method of p5.NumberDict in p5.js is used to find the lowest value in a number dictionary. A number dictionary can store multiple key-value pairs. Syntax: minValue() Parameters: This method does not accept any parameters. Return Value: It returns a Number value that is the lowest value 2 min read Like