Question concerning the Pig Latin challenge

Tell us what’s happening:

Hi ! Could you tell me why this code is not accepted? It says “Should handle words without vowels” but I think it does (check with “Pfft” it returns “Pfftay”).


Your code so far

function translatePigLatin(str) {
  let temp = str;
  let regex = /^[zrtpqsdfghjklmwxcvbn]+/;
  var begin = temp.match(regex);
  temp = temp.replace(regex, "");
  if(begin != null) return temp+begin+"ay"
  else return temp+"way";

  return begin;


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36.

Link to the challenge:

Make sure you handle the word rhythm.