Creates a slice of `array` with `n` elements dropped from the beginning.
drop([1, 2, 3])
// => [2, 3]
drop([1, 2, 3], 2)
// => [3]
drop([1, 2, 3], 5)
// => []
drop([1, 2, 3], 0)
// => [1, 2, 3]
Name | Type | Attribute | Description |
---|---|---|---|
array | The array to query. | ||
n | The number of elements to drop. |
{ "comment": "/**\r\n * Creates a slice of `array` with `n` elements dropped from the beginning.\r\n *\r\n * @since 0.5.0\r\n * @category Array\r\n * @param {Array} array The array to query.\r\n * @param {number} [n=1] The number of elements to drop.\r\n * @returns {Array} Returns the slice of `array`.\r\n * @example\r\n *\r\n * drop([1, 2, 3])\r\n * // => [2, 3]\r\n *\r\n * drop([1, 2, 3], 2)\r\n * // => [3]\r\n *\r\n * drop([1, 2, 3], 5)\r\n * // => []\r\n *\r\n * drop([1, 2, 3], 0)\r\n * // => [1, 2, 3]\r\n */", "meta": { "range": [ 516, 671 ], "filename": "drop.js", "lineno": 25, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100001953", "name": "drop", "type": "FunctionDeclaration", "paramnames": [ "array", "n" ] }, "vars": { "length": "drop~length" } }, "description": "Creates a slice of `array` with `n` elements dropped from the beginning.", "since": "0.5.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Array", "value": "Array" } ], "params": [ { "type": { "names": [ "Array" ] }, "description": "The array to query.", "name": "array" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": 1, "description": "The number of elements to drop.", "name": "n" } ], "returns": [ { "type": { "names": [ "Array" ] }, "description": "Returns the slice of `array`." } ], "examples": [ "drop([1, 2, 3])\r// => [2, 3]\r\rdrop([1, 2, 3], 2)\r// => [3]\r\rdrop([1, 2, 3], 5)\r// => []\r\rdrop([1, 2, 3], 0)\r// => [1, 2, 3]" ], "name": "drop", "longname": "drop", "kind": "function", "scope": "global", "___id": "T000002R000215", "___s": true, "filepath": "drop.js" }