function fearNotLetter(str) {
var arr = str.split('');
var codes = [];
for(var i=0; i<arr.length; i++){
codes.push(arr[i].charCodeAt(0));
}
for(var j=0; j<codes.length; j++){
if(codes[j] != codes[0]+j){
return String.fromCharCode(codes[0]+j);
}
}
return undefined;
}
fearNotLetter("abce");
No comments:
Post a Comment