Answers for "duplicate encoder"

0

duplicate encoder

const duplicateEncode = word => {
    let newString = ''
    word = word.toLowerCase() || word
    word.split('').filter((x, index) => {
      if(word.indexOf(x) !== index){
        newString += ')'
      }else if(word.lastIndexOf(x) !== index){
        newString += ')'
      }else{
        newString += '('
      }
    })
    return newString
}
console.log(duplicateEncode("O!!!!@k!!!H!!!)!!n!"))
Posted by: Guest on June-15-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language