We're a place where coders share, stay up-to-date and grow their careers.
Nice challenge, I tried doing it in JS with an array.reduce and character codes. I think it works well enough! I don't think the arr.splice(1) is really clean though, so perhaps a traditional loop would be better.
const returnMissingLetter = letters => { return letters.reduce((acc, curr, i, arr) => { if (curr.charCodeAt() - acc.charCodeAt() === 1) { return curr; } arr.splice(1); return String.fromCharCode(acc.charCodeAt() + 1); }); };
Nice challenge, I tried doing it in JS with an array.reduce and character codes. I think it works well enough! I don't think the arr.splice(1) is really clean though, so perhaps a traditional loop would be better.