Remove duplicate array based on api response attribute value

Remove duplicate array based on api response attribute value is something different than a normal array. In this post we will find out how we can achieve by comparing attribute value of object array and remove the duplicate array.

Remove duplicate array simple

In the below code what we are doing is, we loop through the original array and check with the ‘if’ condition se see if our blank new array doesn’t have any of original array. If that returns true then we are going to push original array to new array which is going to add only new numbers.