p5.js | getItem() Function
The getItem() function is used to retrieve the value that has been stored using the storeItem() function under the given key name from the local storage of the browser. It returns a null value if the key is not found.
The local storage persists between browsing sessions and can store the values even after reloading the page unless it is cleared.
Parameters: This function accepts a single parameter as mentioned above and described below:
- key: This is a string which denotes the key for which the value has to be retrieved.
Return Value: It returns the value of the stored item, which can be a String, Number, Boolean, Object, p5.Color or a p5.Vector.
Below example illustrates the getItem() function in p5.js:
Online editor: https://editor.p5js.org/
Environment Setup: https://www.geeksforgeeks.org/p5-js-soundfile-object-installation-and-methods/