![]() |
VOOZH | about |
The keys() method is used to return all of the collection's keys.
Syntax:
collect(array).keys()
Parameters: The collect() method takes one argument that is converted into the collection and then keys() method is applied on it.
Return Value: This method returns the collection keys.
Below example illustrate the keys() method in collect.js:
Example 1:
Output:
[ 'name', 'dob', 'section', 'score' ]
Example 2:
Output:
[ 0, 1, 2, 3 ]