I have 2 array of objects
arrayOne = [{objectType: 'License', objectId: 333, objectName: 'Test Object 1', dataType: 'String'}
{objectType: 'Owner', objectId: 334, objectName: 'Test Object 2', dataType: 'String'},
{objectType: 'Location', objectId: 335, objectName: 'Test Object 3', dataType: 'String'}]
arrayTwo = [{objectType: 'LICENSE', objectId: 333, objectName: 'Test Object 1', dataType: 'String'}
{objectType: 'OWNER', objectId: 334, objectName: 'Test Object 4', dataType: 'Value List'},
{objectType: 'LOCATION', objectId: 335, objectName: 'Test Object 3', dataType: 'String'}]
As we can see in arrayTwo
, objectName
and dataType
is changed. It may be possible any of the property might change but the number of objects will be always same on both arrays.
So here, I need to pull the objects from arrayTwo
which has been changed by comparing with arrayOne
and store it in a new array say resultsArray
?
I checked the answers provided in How to get the difference between two arrays of objects in JavaScript it only talks about getting the differences based on one property, not any property. Please suggest on this. Thanks.
EDIT: Edited arrayTwo
to have capital letters for objectType
. I need to ignore the case and result should be case insensitive. Thanks