p5.js Element hasClass() Method
The hasClass() method of p5.Element in p5.js is used to check if the specified class is already present in the element. It returns a boolean value denoting if the class was present or not. An element can have multiple classes assigned to it.
hasClass( class )
Parameters: This function accepts a single parameter as mentioned above and described below.
- class: It is a string that denotes the class to be checked.
Example: The example below illustrates the hasClass() method in p5.js
Online editor: https://editor.p5js.org/
Environment Setup: https://www.geeksforgeeks.org/p5-js-soundfile-object-installation-and-methods/