Home

function: first


first(array: Array): *

Gets the first element of `array`.

Example(s):

head([1, 2, 3])
// => 1

head([])
// => undefined

Params:

Name Type Attribute Description
array The array to query.

Returns:

*

  {
    "comment": "/**\r\n * Gets the first element of `array`.\r\n *\r\n * @since 0.1.0\r\n * @alias first\r\n * @category Array\r\n * @param {Array} array The array to query.\r\n * @returns {*} Returns the first element of `array`.\r\n * @see last\r\n * @example\r\n *\r\n * head([1, 2, 3])\r\n * // => 1\r\n *\r\n * head([])\r\n * // => undefined\r\n */",
    "meta": {
        "range": [
            307,
            407
        ],
        "filename": "head.js",
        "lineno": 18,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100003585",
            "name": "head",
            "type": "FunctionDeclaration",
            "paramnames": [
                "array"
            ]
        }
    },
    "description": "Gets the first element of `array`.",
    "since": "0.1.0",
    "alias": "first",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Array",
            "value": "Array"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "The array to query.",
            "name": "array"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "*"
                ]
            },
            "description": "Returns the first element of `array`."
        }
    ],
    "see": [
        "last"
    ],
    "examples": [
        "head([1, 2, 3])\r// => 1\r\rhead([])\r// => undefined"
    ],
    "name": "first",
    "longname": "first",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000371",
    "___s": true,
    "filepath": "head.js"
}