{"ScriptPreparationCode":"var a = [1, 2, 3, 4, 5, 6, 5, 4];\r\nvar b = [6, 8, 2, 7, 6, 1, 4, 3];\r\n\r\nfunction usingForEach(l1, l2) {\r\n let u = []// Creates a new empty array.\r\n l1.forEach(function(i) { //loops through the first array input.\r\n if (u.indexOf(i) \u003C 0) //If \u0027i\u0027 is not in the new array, it is pushed into the new array.\r\n u.push(i);\r\n });\r\n l2.forEach(function(j) { //loops through the second array input.\r\n if (u.indexOf(j) \u003C 0) //If \u0027j\u0027 is not in the new array, it is pushed into the new array.\r\n u.push(j);\r\n });\r\n return u;\r\n};\r\n\r\nfunction usingSet(l1, l2) {\r\n let u = l1.concat(l2); // Joins the l1 and l2 arrays together using concatenation.\r\n return [...new Set(u)]; // Array is converted into a \u0027Set\u0027 in order to remove duplicates, then is converted back into an array using the spread operator.\r\n};","TestCases":[{"Name":"forEach Test","Code":"var test1 = usingForEach(a,b);","IsDeferred":false},{"Name":"usingSet Test","Code":"var test2 = usingSet(a,b);","IsDeferred":false}]}