Skip to content

Instantly share code, notes, and snippets.

@stephanos7
Last active April 11, 2020 19:15
Show Gist options
  • Save stephanos7/469e54388bc30ec40e428beb2a7b6dad to your computer and use it in GitHub Desktop.
Save stephanos7/469e54388bc30ec40e428beb2a7b6dad to your computer and use it in GitHub Desktop.
const findSingle = (arr) => {
let obj = {}
for(let item of arr ){
if(obj[item]{
obj[item]+= 1
}else{
obj[item] = 1
}
}
for(let item in obj){
if(obj[item] === 1){
return item
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment