We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 75f9d8b commit 4541adfCopy full SHA for 4541adf
Sprint-1/JavaScript/findCommonItems/findCommonItems.js
@@ -14,10 +14,11 @@
14
// ];
15
16
export const findCommonItems = (firstArray, secondArray) => {
17
- let firstArr = new Set(firstArray);
18
- let secondArr = new Set(secondArray);
+ const firstArr = new Set(firstArray);
+ const secondArr = new Set(secondArray);
19
20
- return [...firstArr].filter((arr) => secondArr.has(arr));
+ // return [...firstArr].filter((arr) => secondArr.has(arr));
21
+ return [...firstArr.intersection(secondArr)];
22
};
23
24
// * https://www.w3schools.com/js/js_set_methods.asp#mark_set_new
0 commit comments