16 lines
395 B
TypeScript
16 lines
395 B
TypeScript
export function removeDuplicates(array: []) {
|
|
const unique = [];
|
|
for (let i = 0; i < array.length; i++) {
|
|
if (!unique.includes(array[i])) {
|
|
unique.push(array[i]);
|
|
}
|
|
}
|
|
return unique;
|
|
}
|
|
|
|
export function hasSameElements(a1: any[], a2: any[]) {
|
|
return (
|
|
a1.length == a2.length &&
|
|
a1.reduce((a, b) => a && a2.includes(b), true)
|
|
);
|
|
} |