What are the rules of Pig Latin

Tell us what’s happening:
can someone explain to me the directions of this challenge, what is meant by consonant cluster?
also, what i wrote is not satisfying the 5th condition however it does return “eightway” on the second run of the loop bc thats where i put e in the arr. how can I break out of the loop and only return it when it satisfies the condition?

Your code so far


function translatePigLatin(str) {
  var arr= ["a","e","i","o","u"];
  for (var i=0; i<arr.length; i++){
    if (str.charAt(0)== arr[i]){
  return str+"way"; 
} else {
  return str.substring(1)+str.charAt(0)+"ay";
}
}
}
translatePigLatin("algorithm");

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin