DEV Community

loading...

Discussion on: Daily Challenge #60 - Find the Missing Letter

Collapse
vjoao profile image
Victor Nascimento

const hasLargerDiff = (num, index, list) => list[index + 1] - num > 1;
const toCharCode = char => char.charCodeAt(0);

function findMissingLetter(sequence) {
  const missingCode = sequence
    .map(toCharCode)
    .find(hasLargerDiff) + 1;

  return String.fromCharCode(missingCode)
}