Simple Solution in Javascript
var fourSum = function(nums, target) {\n        var ret = [];\n        \n        if(nums.length == 0)\n            return ret;\n            \n        nums.sort(
    var fourSum = function(nums, target) {\n        var ret = [];\n        \n        if(nums.length == 0)\n            return ret;\n            \n        nums.sort(function(a,b){\n            return a - b;    \n        });\n            \n        for(var i = 0; i < nums.length; i++){\n            var target2 = target - nums[i];\n            \n            for(var j = i + 1; j < nums.length; j++){\n                var target3 = target2 - nums[j];\n                \n                var front = j + 1;\n                var back = nums.length - 1;\n                \n                while(front < back){\n                    var sum = nums[front] + nums[back];\n                \n                    if(sum < target3)\n                        front++;\n                        \n                    else if(sum > target3)\n                        back--;\n                    \n                    else{\n                        var temp = new Array(4);\n                        temp[0] = nums[i];\n                        temp[1] = nums[j];\n                        temp[2] = nums[front];\n                        temp[3] = nums[back];\n                        ret.push(temp);\n                        \n                        while(front < back && nums[front] === temp[2])\n                            front++;\n                            \n                        while(front < back && nums[back] === temp[3])\n                            back--;\n                    }\n                }\n                \n                while(j + 1 < nums.length && nums[j + 1] === nums[j]) ++j;\n            }\n            \n            while(i + 1 < nums.length && nums[i + 1] === nums[i]) ++i;\n        }\n        \n        return ret;\n    };
['JavaScript']