function translatePigLatin(str) {
str = str.split("")
let vowels = 'aeiou'
let index= str.findIndex(value => vowels.includes(value))
if(index == 0) {
return str.splice(index).concat(['w', 'a', 'y']).join('')
}
return str.splice(index).concat(str, ['a', 'y']).join('')
}
console.log(translatePigLatin("eight"))
In the instructions nothing mentions, what should the function return if a word without vowel is passed and my code pass all the test except last one…
help