Hello everyone, i have two questions
To make it clear more, check the code blow, for more clarity, you will find the whole code below (this is the whole code) statement.
My questions are:
1- why did they added The iteration
B after str.charCodeAt(0)
if (charCode !== Str.charCodeAt(0) + B)
2- why did they subtracted 1?
return String.fromCharCode(charCode - 1);
if (charCode !== Str.charCodeAt(0) + B) {
return String.fromCharCode(charCode - 1);
This is the whole code:
function fearNotLetter(Str) {
for (let B = 0; B < Str.length; B = B + 1) {
const charCode = Str.charCodeAt(B);
if (charCode !== Str.charCodeAt(0) + B) {
return String.fromCharCode(charCode - 1);
}
}
return undefined;
}
fearNotLetter("abce");
Your browser information:
User Agent is: Mozilla/5.0 (iPhone; CPU iPhone OS 17_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.1 Mobile/15E148 Safari/604.1
Challenge Information:
Intermediate Algorithm Scripting - Missing letters