Build a Symmetric Difference Function - Build a Symmetric Difference Function

Tell us what’s happening:

i don’t understand how can i pass 6 and 7 test

Your code so far

const diffArray= (arr1,arr2)=>{

if (arr1.length >= arr2.length){

  return arr1.filter((element)=> !arr2.includes(element))

} else {

return arr2.filter((element)=> !arr1.includes(element))

}
}
console.log(diffArray(["pen", "book"], ["book", "pencil", "notebook"]))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36

Challenge Information:

Build a Symmetric Difference Function - Build a Symmetric Difference Function

you are removing from arr1 the elements that are also in arr2 here. But what if arr2 have also some elements that are not in arr1?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.