The subset() function in p5.js is used to get the subset of the given array elements. This function extracts the elements from an existing array.
subset(Array, Start, Count)
Parameters: This function accepts three parameters as mentioned above and described below:
- Array: This parameter holds the array elements on which the subset() operation is to be done to get its subset element.
- Start: This is the number from where extraction is to be done. It’s value starts from 0.
- Count: This is the number of elements which are to be extracted.
Return Value: It returns the extracted elements.
Below programs illustrate the subset() function in p5.js:
Example 1: This example uses subset() function to get the subset of the given array elements.
Example 2: This example uses subset() function to get the subset of the given array elements.
- How to get the function name inside a function in PHP ?
- p5.js | hex() function
- p5.js | str() function
- PHP | Ds\Set last() Function
- PHP | Ds\Set first() Function
- PHP | end() Function
- PHP | Ds\Set add() Function
- p5.js | value() Function
- p5.js | cos() function
- D3.js | d3.map.set() Function
- p5.js | tan() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.