JavaScript `.test()` is not a function

freecodecamp tell to use .test function in

Regular Expressions | Check for mixed grouping of characters

But when I write it in the code area console showed

So I test it in IDE and it show like that too.

My code:

please provide a screenshot of your code.

also make sure that unlike match(), the test() method is applied on the regular expression and the string to be matched is provided as an argument.

@hrs070 edited in post!

as I said earlier, you have to change the result statement. the it will work but you will also need to change the myRegex in order to pass all tests.

I haven’t run the test. The console is showing the error itself.

yes, that is because your result method is incorrect. please read my previous comment as I can not give you a direct answer.

result = testRegex.test(stringToBeMatched)

Thank you your code form explained me what is wrong.

1 Like

In the future please copy-paste your code into your post instead of using a screenshot. It is difficult to help from a screenshot.