this is my code:
let arrA = [1,2,3]
let arrB = [3,4,5,6]
let result = []
// error: Unexpected token
[...arrA,...arrB].forEach(item => {
if(arrA.includes(item)&&!arrB.includes(item)) result.push(item)
})
console.log(result)
but this work well
Array.from([...arrA,...arrB]).forEach(item => {
if(arrA.includes(item)&&!arrB.includes(item)) result.push(item)
})
how does it comes?