Home

function: slice


slice(array: Array, start: number, end: number): Array

Creates a slice of `array` from `start` up to, but not including, `end`. **Note:** This method is used instead of [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are returned.

Params:

Name Type Attribute Description
array The array to slice.
start The start position.
end The end position.

Returns:

Array

  {
    "comment": "/**\r\n * Creates a slice of `array` from `start` up to, but not including, `end`.\r\n *\r\n * **Note:** This method is used instead of\r\n * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are\r\n * returned.\r\n *\r\n * @since 3.0.0\r\n * @category Array\r\n * @param {Array} array The array to slice.\r\n * @param {number} [start=0] The start position.\r\n * @param {number} [end=array.length] The end position.\r\n * @returns {Array} Returns the slice of `array`.\r\n */",
    "meta": {
        "range": [
            521,
            766
        ],
        "filename": "slice.js",
        "lineno": 17,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100008300",
            "name": "slice",
            "type": "FunctionDeclaration",
            "paramnames": [
                "array",
                "start",
                "end"
            ]
        },
        "vars": {
            "length": "slice~length",
            "start": "slice~start",
            "end": "slice~end"
        }
    },
    "description": "Creates a slice of `array` from `start` up to, but not including, `end`.\r\r**Note:** This method is used instead of\r[`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are\rreturned.",
    "since": "3.0.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Array",
            "value": "Array"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "The array to slice.",
            "name": "array"
        },
        {
            "type": {
                "names": [
                    "number"
                ]
            },
            "optional": true,
            "defaultvalue": 0,
            "description": "The start position.",
            "name": "start"
        },
        {
            "type": {
                "names": [
                    "number"
                ]
            },
            "optional": true,
            "defaultvalue": "array.length",
            "description": "The end position.",
            "name": "end"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "Returns the slice of `array`."
        }
    ],
    "name": "slice",
    "longname": "slice",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000762",
    "___s": true,
    "filepath": "slice.js"
}