JavaScript DFS Solution
\n/**\n * @param {number[][]} edges\n * @return {number[]}\n */\nvar findRedundantConnection = function(edges) {\n    let map = {};\n    let currRedundant = nul
```\n/**\n * @param {number[][]} edges\n * @return {number[]}\n */\nvar findRedundantConnection = function(edges) {\n    let map = {};\n    let currRedundant = null;\n    \n    const dfs = (u, v, visited) => {\n        visited.add(u);\n        \n        if (u in map){\n            if (map[u].has(v)) return true;\n            for (let w of map[u]){\n                if (!visited.has(w)){\n                    visited.add(w);\n                    if (dfs(w, v, visited)) return true;\n                }\n            }\n            return false;\n        }\n        return false;\n    }\n    \n    for (let edge of edges){\n        let [u, v] = edge;\n        \n        if (dfs(u, v, new Set())) currRedundant = edge;\n        \n        if (!(u in map)) map[u] = new Set();\n        if (!(v in map)) map[v] = new Set();\n        \n        map[u].add(v);\n        map[v].add(u);\n    }\n    \n    return currRedundant;\n};\n```
['Depth-First Search', 'JavaScript']