PigLatin algorithm

Tell us what’s happening:
Else if statements not executing correctly. The first 3 ticks are correct, however on ‘algorithm’ and ‘eight’ it doesn’t seem to execute the else if statement to at the ‘way’ to the end of those strings. Could someone guide me on why this could be happening.

Thank you
Your code so far

function translatePigLatin(str) {

if (str.charAt(0) !== 'a' || 'e' || 'i' || 'o' || 'u') {

  let strVowel = str.search(/[aeiou]/g);
  let cutOf = str.substr(strVowel).concat(str.slice(0, strVowel)).concat("ay");

  return cutOf;
} else if (str.charAt(0) == 'a' || 'e' || 'i' || 'o' || 'u') {

  return str.concat("way");


  **Your browser information:**

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

Challenge: Pig Latin

Link to the challenge:

That’s not how you do comparison in if statement. If you want to check multiple values you should write condition for each value. Checks between || are self containing, meaning str.charAt(0) !== 'a' is checked first, if it fails, then 'e' is checked, which will always return true. Therefore your else if will never run.

1 Like