Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function haveCommonEntry(arr1, arr2) {
- let tolerance = 8;
- if ( arr1.length < tolerance || arr2.length < tolerance ) {
- return arr1.some(item => arr2.includes(item));
- } else {
- const set1 = new Set(arr1); return arr2.some(v => set1.has(v));
- return set1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement