20 lines
624 B
JavaScript
20 lines
624 B
JavaScript
"use strict";
|
|
exports.__esModule = true;
|
|
exports.findOdd = void 0;
|
|
var findOdd = function (numbers) {
|
|
var _loop_1 = function (number) {
|
|
if (numbers.filter(function (x) { return x === number; }).length % 2 !== 0) {
|
|
return { value: number };
|
|
}
|
|
};
|
|
for (var _i = 0, numbers_1 = numbers; _i < numbers_1.length; _i++) {
|
|
var number = numbers_1[_i];
|
|
var state_1 = _loop_1(number);
|
|
if (typeof state_1 === "object")
|
|
return state_1.value;
|
|
}
|
|
return 69;
|
|
};
|
|
exports.findOdd = findOdd;
|
|
var test = [1, 1, 2, 3, 2];
|
|
console.log((0, exports.findOdd)(test));
|