Q1: Find the Intersection of Two Arrays.
Write a function that returns the common elements between two arrays.
Ans:
function arrayIntersection(arr1, arr2) {
return arr1.filter(item => arr2.includes(item));
}
console.log(arrayIntersection([1, 2, 3, 4], [3, 4, 5, 6]));
// Output: [3, 4]
🧠 Tip: Use Set for better performance with...
🛡️ VERIFIED CYBER INTELLIGENCE ID: #2995584