Filters an array of objects such that only unique versions of the objects exist within
the new array. A given object instance is considered unique based on the value of an
object property that should indicate uniqueness. The function returns a copy of the array
where only one instance (the first instance) of a given object with the uniqueProperty
value exists. For eg:
Filters an array of objects such that only unique versions of the objects exist within the new array. A given object instance is considered unique based on the value of an object property that should indicate uniqueness. The function returns a copy of the array where only one instance (the first instance) of a given object with the
uniqueProperty
value exists. For eg:Should result, respectively, in:
and
[ { name: "A", size: 12 }, { name: "B", size: 11 }, { name: "B", size: 15 }, ]
Will return a new array where only one version of John exists.
Returns
Returns the unique object array