JSFiddle - React, Tailwind, and code Playground
by TCloud
JavaScript
function findMissingLetter(array)
{
/* for (let i = 0; i < array.length; i++) {
if( i < array.length - 1 && array[i].charCodeAt(0) + 1 != array[i + 1].charCodeAt(0) ) {
return String.fromCharCode( array[i].charCodeAt(0) + 1 )
}
} */
let res;
return array.map( (item, i) => {
if( i < array.length - 1 && item.charCodeAt(0) + 1 != array[i + 1].charCodeAt(0) ) {
res = String.fromCharCode( item.charCodeAt(0) + 1 )
}
} )
return res
}
console.log( findMissingLetter(['a','b','c','d','f']) )