Find the stray number code example
Example: Find the stray number
const stray = numbers => {
let number = 0
numbers.forEach(x => numbers.indexOf(x) ? number = x : null)
return number
}
console.log(stray([17, 17, 3, 17, 17, 17, 17]))
const stray = numbers => {
let number = 0
numbers.forEach(x => numbers.indexOf(x) ? number = x : null)
return number
}
console.log(stray([17, 17, 3, 17, 17, 17, 17]))