11 lines
279 B
TypeScript
11 lines
279 B
TypeScript
export const findOdd = (numbers: number[]): number => {
|
|
for (const number of numbers) {
|
|
if (numbers.filter(x => x===number).length % 2 !== 0){
|
|
return number;
|
|
}
|
|
}
|
|
return 69;
|
|
}
|
|
|
|
const test: number[] = [1,1,2,3,2]
|
|
console.log(findOdd(test))
|