{"ScriptPreparationCode":null,"TestCases":[{"Name":"Filter","Code":"const array1 = [1, 2, 3, 4, 5];\r\nconst array2 = [3, 4, 5, 6, 7];\r\n\r\nconst difference =\r\n array1.filter((element) =\u003E !array2.includes(element));","IsDeferred":false},{"Name":"For loop","Code":"const array1 = [1, 2, 3, 4, 5];\r\nconst array2 = [3, 4, 5, 6, 7];\r\n\r\nconst difference = [];\r\n \r\n for (let i = 0; i \u003C array1.length; i\u002B\u002B) {\r\n if (array2.indexOf(array1[i]) === -1) {\r\n difference.push(array1[i]);\r\n }\r\n }","IsDeferred":false},{"Name":"Set","Code":"const array1 = [1, 2, 3, 4, 5];\r\nconst array2 = [3, 4, 5, 6, 7];\r\n\r\nconst set1 = new Set(array1);\r\nconst set2 = new Set(array2);\r\n \r\nconst difference = [...set1].filter(\r\n (element) =\u003E !set2.has(element));","IsDeferred":false},{"Name":"Reduce","Code":"const array1 = [1, 2, 3, 4, 5];\r\nconst array2 = [3, 4, 5, 6, 7];\r\n\r\nconst difference = array1.reduce((result, element) =\u003E {\r\n if (array2.indexOf(element) === -1) {\r\n result.push(element);\r\n }\r\n return result;\r\n}, []);","IsDeferred":false}]}