Specify Upper and Lower Number of Matches -- help

Tell us what’s happening:

I first tried the following regex /h{3,6}/;
It didn’t work, why?
It didn’t pass the last test of: “Ohhhhhhh no”

Your code so far


let ohStr = "Ohhh no";
let ohRegex = /Oh{3,6} no/; // Change this line
let result = ohRegex.test(ohStr);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches

I think /h{3,6}/ will pass as long as it finds between 3 and 6 h’s which “Ohhhhhhh” does, it doesnt matter that it contains more h’s, your regex just says return true if there are between 3 and 6.

I am using Chrome, did not pass, bug maybe.

let ohStr = “Ohhh no”;
let ohRegex = /h{3,6}/; // Change this line
let result = ohRegex.test(ohStr);

Tried again, didn’t work again.

Well, under “tell us what is happening” at the top of my post I mentioned the exact same code I wrote recently on this post.

I tried explaining what was going wrong above, the upper limit won’t work the way you want if its associated with just one character

Is there any reason for that or just a JS quirk?