![]() |
VOOZH | about |
The _.first() method is used to get the first element of the specified array.
Syntax:
_.first(array)Parameters: This method accepts a single parameter as mentioned above and described below:
Return Value:
Example 1:
Output:
5
2
gfg
Example 2:
Output:
undefinedNote: This will not work in normal JavaScript because it requires the Lodash library to be installed.