function getIntersect(arr1, arr2) {
let ret = []
arr1.forEach(item => {
if (arr2.includes(item) && !ret.includes(item)) {
ret.push(item)
}
})
return ret
}
console.log(getIntersect([1, 2, 2, 1], [2, 2]))
console.log(getIntersect([4, 9, 5], [9, 4, 9, 8, 4]))