In this code I want to return the alphabet that's missing in a string of continuous alphabets, and if all alphabets are present I want to return undefined. However, instead returning defined, it returns "{" and I can't find similar cases anywhere online.
function fearNotLetter(str) {
for (let i = 0; i < str.length; i++) {
if (str.charCodeAt(i) !== str.charCodeAt(i + 1) - 1) {
return String.fromCharCode(str.charCodeAt(i) + 1)
}
}
return undefined
}
console.log(fearNotLetter("abcdefghijklmnopqrstuvwxyz"))