Skip to content

Instantly share code, notes, and snippets.

@mornir
Last active December 7, 2018 15:13
Show Gist options
  • Save mornir/1fc32606f11e6fb57c7190fe3d9baddb to your computer and use it in GitHub Desktop.
Save mornir/1fc32606f11e6fb57c7190fe3d9baddb to your computer and use it in GitHub Desktop.
alphabetPosition
function alphabetPosition(text) {
const arrayOfLetters = text.toLowerCase().split('')
return arrayOfLetters.map(letter => {
const code = letter.charCodeAt()
if(code < 97 || code > 122) return null
return code - 96
}).filter(num => num !== null).join(' ')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment