check if number appears odd number of times in array javascript
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;
}
Also in JavaScript:
- javascript get a random number with 6 digits
- gatsby-plugin-nprogress
- parse json to dart model
- function in javascript
- sleep javascript
- string to char array javascript
- ajax error get output
- how to make a translator in python
- js !==
- nodejs hashing
- javascript copy array
- navigation.openDrawer is not a function react native
- javascript get values from object
- js how to hide an image
- extract string from text file javascript
- loopback not null
- convert date to unix timestamp javascript
- javascript date minus seconds
- odd or even js
- javascript select element in dropdown
- reload page javascript
- match js
- react router 404 redirect
- string methods javascript count number of words inside a string