📜  检查数字是否在数组中出现奇数次javascript代码示例

📅  最后修改于: 2022-03-11 15:03:35.387000             🧑  作者: Mango

代码示例2
function findOdd(A) {
    let counts = A.reduce((p, n) => (p[n] = ++p[n] || 1, p), {});
    return +Object.keys(counts).find(k => counts[k] % 2) || undefined;
}