DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,673 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in

Discussion on: JavaScript Programming Problem

Collapse
 
alinp25 profile image
Alin Pisica

I am not sure 100% about correctitude, I wrote it from my phone, but I hope it's doing well.

var alphabetPosition = str => str.split("").map(x => 
    x.match(/[a-z]/i) 
      ? (x.charCodeAt(0) - 96).toString() 
      : '')
    .filter(x => x.length)
    .join(' ');
Enter fullscreen mode Exit fullscreen mode
Collapse
 
alekseiberezkin profile image
Aleksei Berezkin

That's faster than the original solution

Collapse
 
hijazi313 profile image
Muhammad Hamza Hijazi Author

it's working correctly <3