Great idea for a series! But I think the question is a little under-specified. It'd be helpful to state that the output should also be a string (not an array), that alphabet places are 1-indexed, that each one must be followed by a space, and that you only need to handle lowercase Latin-alphabet letters without diacritics.
Anyway, here's my attempt:
const a = 'a'.codePointAt(0)
const alphaPos = str => str.replace(
/[a-z]/g,
ch => `${ch.codePointAt(0) - a + 1} `
)
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.
Great idea for a series! But I think the question is a little under-specified. It'd be helpful to state that the output should also be a string (not an array), that alphabet places are 1-indexed, that each one must be followed by a space, and that you only need to handle lowercase Latin-alphabet letters without diacritics.
Anyway, here's my attempt: