Scenario
We have an array [1,2,3]
and we want to know whether the numbers are unique.
Approach
function isArrayUnique(target: any[]): boolean {
const uniqueItems = target.filter((a, b, c) => c.indexOf(a) === b);
return target.length === uniqueItems.length;
}