var data= ; //sample array fill up data with 10000 rows,
var uniqueCustomer=[…new Set(data.map(a=>a.customerID))];
Above will create a unique customerID from each of the record in data using customerID as property.
If the array contains no objects and property, data.map is no longer required.
- data.map, return customerID as array
- new Set, create a Set object that cannot be duplicate, those customerID that is duplicate will be discarded
- spread operator, apply new set created as a new array.