0

Just learning basics of JavaScript and trying to get rid off vowels from a string:

function disemvowel(str) {
  let no_vowels = '';
  for (let a = 0; a < str.length; a++) {
    if (str[a] !== 'a' || str[a] !== 'A' || str[a] !== 'i' ||
        str[a] !== 'I' || str[a] !== 'o' || str[a] !== 'O' ||
        str[a] !== 'u' || str[a] !== 'U' || str[a] !== 'e' ||
                                              str[a] !== 'E') {
      // if none of the above is in the index add it to no_vowels
      no_vowels += str[a];
   }
  }
  return no_vowels;
}

String is unchanged. Why ?

mr_incredible
  • 837
  • 2
  • 8
  • 21

0 Answers0