![]() |
VOOZH | about |
The whereInstanceOf() function is used to filter input with a given class type. In JavaScript, the array is first converted to a collection and then the function is applied to the collection.
Syntax:
data.whereInstanceOf('key')
Parameters: This function accepts a single parameter as mentioned above and described below:
Return value: Return the collection with a key value that was mentioned.
Below examples illustrate the whereInstanceOf() function in collect.js
Example 1: Here in this example, we take a collection and then using the whereInstanceOf() method we have returned filtered collection using the key.
Output:
[
new Books('Pride and prejudice'),
new Books('The Great Gatsby'),
]
Example 2: Same thing we have done here as the above example.