Pig Latin: confusing instructions

Hello fellow learners!

I’ve been trying to sort this one out:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin

but I just don’t understand the instructions! I’ve read all the threads on the subject in the forum (and there are a lot on the same topic) but because my code doesn’t look like any other I found, I find it hard to pick up on what I am missing. Here is my code:

function translatePigLatin(str) {
  var conVow = /^[b-df-hj-np-tv-z][aeiou]/i
  var conCon = /^[b-df-hj-np-tv-z][b-df-hj-np-tv-z]/i
  var vowelFirst = /^[aeiou]/i
  var vowel = /[aeiou]/i
  if(!str.match(vowel)){
    return str + "ay";
  }else if(str.match(conCon)){
    var first_letters = str.slice(0,2)
    return str.slice(2)+first_letters + "ay";
    
  }else if(str.match(conVow)){
    var first_letter = str.slice(0,1)
    return str.slice(1)+first_letter + "ay";
  }else{ 
    return str + "way";
  } 
}
translatePigLatin("consonant");

It passes ALL the tests but: “Should handle words where the first vowel comes in the end of the word.”
Problem is: I don’t even understand what it means !!! ↷( ó╻ò)
If the word starts with a vowel, don’t we just add “way” at the end?

translatePigLatin("algorithm") should return "algorithmway".

I’ve read the Wikipedia on PigLatin and all but I’m still clueless about what is expected of me.
Hum…Any clue on what I’m missing because I’m utterly confused.(・_・ヾ
Thanks

This is not a real word, but example of vowel at the end of the word: bcdfghil (not last letter but at the end), bcdfghjklmnpo (last letter of the word)

Thanks for taking the time to answer! Ok, your answer clarifies the meaning of the instruction.
However, what are we supposed to do in this specific case?
According to the instructions given
bcdfghil should turn into dfghilbcay
bcdfghjklmnpo should turn into dfghjklmnpobcay

:expressionless:

You need to move the consonant cluster that is at the beginning of the word at the end of it and add ay

So bcdfghil becomes ilbcdfghay and bcdfghjklmnpo becomesobcdfghjklmnpay in that same way that gloves should become ovesglay

1 Like

aahhhhhhhhhhhh…
Σ(°ロ°)
Make sense now.
Thanks!