Last active
April 11, 2020 19:15
-
-
Save stephanos7/469e54388bc30ec40e428beb2a7b6dad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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