JavaScript using 4 pointers beats 96%
\n/**\n * @param {number[]} nums\n * @param {number} target\n * @return {number[][]}\n */\nvar fourSum = function(nums, target) {\n    nums.sort((a, b) => a - b
```\n/**\n * @param {number[]} nums\n * @param {number} target\n * @return {number[][]}\n */\nvar fourSum = function(nums, target) {\n    nums.sort((a, b) => a - b);\n    const result = []\n    \n    for(let i = 0; i < nums.length - 3; i++) {\n        for(let j = i + 1; j < nums.length - 2; j++) {\n            let low = j + 1;\n            let high = nums.length - 1\n\n            while(low < high) {\n                const sum = nums[i] + nums[j] + nums[low] + nums[high];\n                if(sum === target) {\n                    result.push([nums[i], nums[j], nums[low], nums[high]])\n                    while(nums[low] === nums[low + 1]) low++;\n                    while(nums[high] === nums[high - 1]) high--;\n                    low++;\n                    high--;\n                } else if(sum < target) {\n                    low++\n                } else {\n                    high--\n                }\n            }   \n            while(nums[j] === nums[j + 1]) j++;\n        }   \n        while(nums[i] === nums[i + 1]) i++;\n    }\n    return result\n};\n```
['JavaScript']