Home

function: intersection


intersection(arrays: Array): Array

Creates an array of unique values that are included in all 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.

Example(s):

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

Params:

Name Type Attribute Description
arrays The arrays to inspect.

Returns:

Array

  {
    "comment": "/**\r\n * Creates an array of unique values that are included in all 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 * @since 0.1.0\r\n * @category Array\r\n * @param {...Array} [arrays] The arrays to inspect.\r\n * @returns {Array} Returns the new array of intersecting values.\r\n * @example\r\n *\r\n * intersection([2, 1], [2, 3])\r\n * // => [2]\r\n */",
    "meta": {
        "range": [
            698,
            886
        ],
        "filename": "intersection.js",
        "lineno": 20,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100003747",
            "name": "intersection",
            "type": "FunctionDeclaration",
            "paramnames": [
                "arrays"
            ]
        },
        "vars": {
            "mapped": "intersection~mapped"
        }
    },
    "description": "Creates an array of unique values that are included in all 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.",
    "since": "0.1.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Array",
            "value": "Array"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "optional": true,
            "variable": true,
            "description": "The arrays to inspect.",
            "name": "arrays"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "Returns the new array of intersecting values."
        }
    ],
    "examples": [
        "intersection([2, 1], [2, 3])\r// => [2]"
    ],
    "name": "intersection",
    "longname": "intersection",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000385",
    "___s": true,
    "filepath": "intersection.js"
}