Match method help

Dear all,
I have been trying to use a match method in an exercise of hackerrank .
It seems the parameter I am giving to the exercise is not defined.
Can anyone help me please:
The parameter is word .

function vowelsAndConsonants(word){
    let vowels = word.match(/[o]/gi);
    for(let value of vowels){
    let consonants = s.match(/[wrd]/gi);
    for(let value of consonants){


s is not defined. What are you trying to match here?

Also, when you call the function, you should be passing a string. You’re essentially passing an undefined variable (word), so the function can’t do anything with it.

1 Like