Compare 2 arrays and find its difference

Compare 2 arrays and find its difference

arr1 = [“Object1”, “Object2”, “Object3”, “Object4” ]

arr2 = [“Object3”, “Object4”, “Object5”, “Object6”]

new_array = (arr1 – arr2 | arr2 – arr1)

=> [“Object3“, “Object4“, “Object5“, “Object6“]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.