Nice!
(Btw, you can use .indexOf on strings too)
.indexOf
My weird takes:
A regex approach
const positionInAlphabet = c => 'abcdefghijklmnopqrstuvwxyz' .replace(new RegExp(c + '.*', 'i') , c).length
Parsing with alphabet radix (26 + 10 for 0-9 numbers)
const positionInAlphabet = c => Number.parseInt(c, 36) - 9
Michael, make em a bit harder, please, to leave us some space for creativity :)
Hey Kostia,
nice solution!
I probably wouldn't ever use my array solution, because the prettier formatting would blocked the whole screen vertically haha.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice!
(Btw, you can use
.indexOf
on strings too)My weird takes:
A regex approach
Parsing with alphabet radix (26 + 10 for 0-9 numbers)
Michael, make em a bit harder, please, to leave us some space for creativity :)
Hey Kostia,
nice solution!
I probably wouldn't ever use my array solution,
because the prettier formatting would blocked the whole screen vertically haha.