Regular exp ,matching single character

Regular expression, Matching all single characters ,vowels
My program is giving the right result .But freecodecamp is throwing error
this is my pgm
let quoteSample = “Beware of bugs in the above code; I have only proved it correct, not tried it.”;

var vcount=0;

let vowelRegex = /[aeiou]/i; // Change this line

for (var i=0;i<quoteSample.length;i++)


let result = quoteSample[i].match(vowelRegex); // Change this line





What is the url of the challenge?

The error its showing–

Cannot read property ‘length’ of null

Cannot read property ‘length’ of null

Cannot read property ‘join’ of null
its telling have to count 25 vowels-
my pgm is counting 25 vowels and not counting any consonants

@pree you dont need to loop the match method has that built in for you .

When you see comments like the ones to the right of the two lines, that means those are the only two lines you should be changing to solve the challenge.

let vowelRegex = /change/; // Change this line
let result = vowelRegex; // Change this line

You will need to create a regular expression in the first line and then use the regular expression with a string method shown in the examples.

1 Like

yes…, got it now. hadn’t used /g
thanks @kravmaguy @RandellDawson

1 Like