DEV Community

Discussion on: Daily Challenge #304 - Consecutive Letters

Collapse
 
jehielmartinez profile image
Jehiel Martinez
function solve (str) {
  let state = false
  const sorted = str
   .split('')
   .map(char => char.charCodeAt())
   .sort()

   sorted.every((char, index) => {
    if(char + 1 === exp[index+1]){
      state = true
    }
  })

  return state
}
Enter fullscreen mode Exit fullscreen mode