Creates an array of `array` values not included in the other given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) for equality comparisons. The order and references of result values are determined by the first array. **Note:** Unlike `pullAll`, this method returns a new array.
difference([2, 1], [2, 3])
// => [1]
Name | Type | Attribute | Description |
---|---|---|---|
array | The array to inspect. | ||
values | The values to exclude. |
{ "comment": "/**\r\n * Creates an array of `array` values not included in the other given arrays\r\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\r\n * for equality comparisons. The order and references of result values are\r\n * determined by the first array.\r\n *\r\n * **Note:** Unlike `pullAll`, this method returns a new array.\r\n *\r\n * @since 0.1.0\r\n * @category Array\r\n * @param {Array} array The array to inspect.\r\n * @param {...Array} [values] The values to exclude.\r\n * @returns {Array} Returns the new array of filtered values.\r\n * @see union, unionBy, unionWith, without, xor, xorBy, xorWith,\r\n * @example\r\n *\r\n * difference([2, 1], [2, 3])\r\n * // => [1]\r\n */", "meta": { "range": [ 864, 1029 ], "filename": "difference.js", "lineno": 24, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100001793", "name": "difference", "type": "FunctionDeclaration", "paramnames": [ "array", "values" ] } }, "description": "Creates an array of `array` values not included in the other given arrays\rusing [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\rfor equality comparisons. The order and references of result values are\rdetermined by the first array.\r\r**Note:** Unlike `pullAll`, this method returns a new array.", "since": "0.1.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Array", "value": "Array" } ], "params": [ { "type": { "names": [ "Array" ] }, "description": "The array to inspect.", "name": "array" }, { "type": { "names": [ "Array" ] }, "optional": true, "variable": true, "description": "The values to exclude.", "name": "values" } ], "returns": [ { "type": { "names": [ "Array" ] }, "description": "Returns the new array of filtered values." } ], "see": [ "union, unionBy, unionWith, without, xor, xorBy, xorWith," ], "examples": [ "difference([2, 1], [2, 3])\r// => [1]" ], "name": "difference", "longname": "difference", "kind": "function", "scope": "global", "___id": "T000002R000203", "___s": true, "filepath": "difference.js" }