p5.js TypedDict remove() Method Last Updated : 27 Nov, 2020 Comments Improve Suggest changes Like Article Like Report 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 store multiple key-value pairs that can be accessed using the methods of the dictionary. Syntax: remove( key ) Parameters: This method accepts a single parameter as shown above and discussed below: key: This is a string that denotes the key that has to be checked in the dictionary. The example below illustrates the remove() method in p5.js: Example: JavaScript function setup() { createCanvas(550, 400); textSize(16); let tmpObj = { "Statue of Unity": "182 m", "Spring Temple Buddha": "128 m", "Ushiku Daibutsu": "100 m", "Great Buddha of Thailand": "92m" }; // Create a new string dictionary let stringDict = createStringDict(tmpObj); text("New string dictionary created", 20, 20); // Checking the size of the dictionary let currSize = stringDict.size(); text("The current size of the " + "dictionary is: " + currSize, 20, 40); let existOne = stringDict.hasKey("Statue of Unity"); text("Dictionary has key " + "'Statue of Unity': " + existOne, 20, 80); let existTwo = stringDict.hasKey("Spring Temple Buddha"); text("Dictionary has key " + "'Spring Temple Buddha': " + existTwo, 20, 100); // Removing one key stringDict.remove("Spring Temple Buddha"); text("One key removed from the dictionary", 20, 140); // Checking the size of the dictionary again currSize = stringDict.size(); text("The current size of the dictionary is: " + currSize, 20, 160); // Checking for the removed key existTwo = stringDict.hasKey("Spring Temple Buddha"); text("Dictionary has key " + "'Spring Temple Buddha': " + existTwo, 20, 200); // Checking the other keys let existThree = stringDict.hasKey("Ushiku Daibutsu"); text("Dictionary has key " + "'Ushiku Daibutsu': " + existThree, 20, 220); } 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/remove Comment More infoAdvertise with us Next Article p5.js TypedDict remove() 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 print() Method 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 pa 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 Like