0
let swappedName = "elZerO";

// // Output
// "ELzERo"

for (let i = start; i < swappedName.length; i++) {
  if (swappedName[i] == swappedName[i].toLowerCase()) {
    swappedName[i] = swappedName.toUpperCase();
  } else if (swappedName[i] == swappedName[i].toUpperCase()) {
    swappedName[i] = swappedName.toLowerCase();
  }
  console.log(swappedName);
}

Hello i'm a JavaScript beginner and i have a challenge to Complete the challenge is for example i have a string that is eLZerO i need to convert upper case letter to lower case like ElzERo letters and vise virsa this is the Code that i wrote i can't change the varibles in the challenge

MrAhmed Alhamed
  • 223
  • 2
  • 3
  • 9
  • Strings in JavaScript are immutable. You can't modify them. You can only create new strings. – jabaa Nov 05 '22 at 03:37

0 Answers0