So in this problem we are given 2arrays (arr1) and (arr2).we have to compare them symmetrically. That means if any word is inside arr1 and not arr2 it is not symmetrical and it has to be in newArray ,which we will return.

Let’s get into it…

so we can remove newArr’s declaration an empty array .we should concat arr1 to arr2 cause its simpler to compare items in it.

then we filter arr1 and pass item in its parameters.item equals to numbers or words in arr1 and arr2.we should use includes function to see array’s items .

so what include function does in this is ,first it checks if item does not exists in arr1() and if it returns false then arr1 includes given item then it checks if that item does not exists in arr2 and if it returns false again then it goes on to the next one until items exist but if it returns true then that means that item exists in arr1 but does not in arr2 ,so it will be added in newArr().so if arr1 returns true and item does not exists in arr1 then it will exist in arr2 and it will be added into newArr().so in this filter() include() can return true 2 times but never 2 false. Thats because we merged arr1 and arr2 so this certain item exists in either one of them and it is impossible to return 2 false.

full solution

so that was all.follow for more ,bye!

JavaScript & React