loading...

Missing letters FCC intermediate algorithm

95freedom95 profile image Oscar Hernandez ・1 min read

//Intermediate Algorithm Scripting: Missing lettersPassed

//Find the missing letter in the passed letter range and return it.

//If all letters are present in the range, return undefined.//

function fearNotLetter(str) {
var args = []; var arr =[]; var arrX =[];
for(let i = 0; i < str.length; i++){
arr = str.charCodeAt(1+i);
if(arr > str.length){
args = String.fromCharCode(arr-1);
};
if(args[0] > str[i]){
arrX = args;
}else if(args[i] === str[i]){
arrX = undefined; console.log(arrX)
};
};

return arrX;
};
fearNotLetter("abce");
//fearNotLetter("abcdefghjklmno");
//fearNotLetter("stvwx");
//fearNotLetter("bcdf");
//fearNotLetter("abcdefghijklmnopqrstuvwxyz")
//https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/missing-letters

Posted on by:

95freedom95 profile

Oscar Hernandez

@95freedom95

I AM oriented to learn new things, student at Free code camp.

Discussion

markdown guide