Your Submissions
You haven't submitted any code for this challenge yet. Solve the problem by passing all the test cases, and your submissions will appear here.
xxxxxxxxxx52
// Function to find all unique quadruplets that add up to the target sum.// FILL OUT YOUR SOLUTION HEREfunction fourSum(nums, target) {  // Write your logic here.}// Utility function to compare two 2D arraysfunction are2DArraysEqual(arr1, arr2) {  if (arr1.length !== arr2.length) return false;  for (let i = 0; i < arr1.length; i++) {    if (arr1[i].length !== arr2[i].length) return false;    for (let j = 0; j < arr1[i].length; j++) {      if (arr1[i][j] !== arr2[i][j]) return false;    }  }  return true;}// Test cases to validate your solutionfunction runTests() {  // Test Case 1  let testCase1 = fourSum([1, 0, -1, 0, -2, 2], 0);  let expected1 = [[-2, -1, 1, 2], [-2, 0, 0, 2], [-1, 0, 0, 1]];  // You can sort the arrays for easier comparison  console.log("Test Case 1: ", are2DArraysEqual(testCase1, expected1) ? "Passed" : "Failed");OUTPUT
Results will appear here.