DEV Community

[Comment from a deleted post]
Collapse
 
raulcg profile image
RaulC-G • Edited

another way:

function uniques (
item: T,
index: number,
array: any[]
) : T { return array.indexOf(item) == index); }

function everyIsUnique (array : any[]) : boolean {
return array.filter(uniques).length == array.length
}