Daily Coding Challenge - Hidden Key

Tell us what’s happening:

I cannot figure out why I cannot get pass #3 and #5. Can you spot the error? Decode ("UAC DYR EISAKYM) or Decode ("W IQQURV UG I ZDMDTRV IVW JQDHY TMHSA QB).

Your code so far

function decode(message) {
  const key = "VLHCGMDLNHVL";
  const A = "A".charCodeAt(0);
  let result = "";
  let ki = 0;

  for (let ch of message) {
    if (ch === " ") {
      result += " ";
      continue;
    }

    const shift = key.charCodeAt(ki % key.length) - A + 1;
    const encoded = ch.charCodeAt(0) - A;
    const decoded = (encoded - shift + 26) % 26;

    result += String.fromCharCode(decoded + A);
    ki++;
  }

  return result;
}















Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36 Edg/147.0.0.0

Challenge Information:

Daily Coding Challenge - Hidden Key
https://www.freecodecamp.org/learn/daily-coding-challenge/2026-04-17

Take a look at what you have for the value of key. If we are taking the first letter from the title of each challenge that is a multiple of 25 we should have about 10 characters.