Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function oddOccurrences(input){
- let result = {}
- let resultWord = ""
- let words= input.split(" ")
- .map(word=>word.toLowerCase())
- .forEach(element => {
- if(!result.hasOwnProperty(element)){
- result[element] = 1
- }
- result[element]++
- });
- for(let word in result){
- if (result[word]%2!==1){
- resultWord+=`${word} `
- delete result[word]
- }
- }
- console.log(resultWord)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement