DEV Community

Oscar Hernandez
Oscar Hernandez

Posted on

2 1

Missing letters FCC intermediate algorithm

//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

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay