Code change:
Lesson asks you to, "declare a regex variable. Assign it a regular expression that matches a number (including decimal numbers) followed by a or / operator followed by another number," but will accept regex' from users that don't satisfy this criteria (examples /d/ and /5/, matching anything with just a number, and anything with a 5 in it). Related issue to address test being too strict. Opened from forum post: Lesson should pass when Regex matches against a number, followed by a or / operator, followed by another number, but matches any number. Regex's that pass but should not (likely not limited to): /5/ /d/ // No response Device: [e.g. iPhone 6, Laptop] OS: [e.g. iOS 14, Windows 10, Ubuntu 20.04] Browser: [e.g. Chrome, Safari] Version: [e.g. 22] No response
It looks like the last test to could be updated to include a few more assertions like this js assert.isTrue(highPrecedence("53")); assert.isFalse(highPrecedence("5")); assert.isTrue(highPrecedence("10/2")); assert.isFalse(highPrecedence("")); But also, looking at this challenge again, I think it could be simplified. At this point, we should only be testing for the final result and allow campers to solve it however they want to. Here is my proposed update js assert.isBoolean(highPrecedence("122")); js assert.isTrue(highPrecedence("53")); assert.isFalse(highPrecedence("5")); assert.isTrue(highPrecedence("10/2")); assert.isFalse(highPrecedence("")); I'll open this up for discussion so the other members can chime in with thoughts.
I see this as the only test for the regular expression itself: Your variable should be a regular expression. does this issue require the addition of more tests? and if so, should there be seperate tests for each regex that produces an unexpected behavior like /5/ and /d/ or just one test that ensures the regex conforms to what was asked for (includes the two numbers, * symbol, / symbol, and 3 capture groups)?
The test you mentioned here only checks that the a regex variable was created and that some sort of regex is being used Currently this test is checking for the correct result js assert.strictEqual(highPrecedence("53"), true); but it right now allows for multiple incorrect answers My proposal is to rewrite the lesson to allow for more correct answers and ensure that incorrect answers don't pass. Right now, you have to create a regex variable and you have to return But there are dozens of correct answers and this should be rewritten to allow for that. So you can see my note here for my proposed changes The thing we want to be carefully about is not using regex tests to check for this. Because that is what is happening for the other lessons and it is difficult to maintain and only allows for a specific answer. So that is why this is marked as open for discussion
Opening this up for contribution - a PR which resolves this will follow Jessica's updated approach in to test the function result, regardless of the function implementation.

Related discussion:
text: --- # --description-- <ins> In your `highPrecedence` function, declare a variable using `const` and assign it a regex that checks if the string passed to the `str` parameter matches the pattern of a number followed by a `*` or `/` operator followed by another number. </ins> <del> In your `highPrecedence` function, declare a `regex` variable. Assign it a regular expression that matches a number (including decimal numbers) followed by a `*` or `/` operator followed by another number. Each number, and the operator, should be in separate capture groups. Incorporate the regular expression you've defined into your `highPrecedence` function to test if the provided string `str` matches the pattern. Use the `test()` method on your `regex` variable and return the result. </del> <ins> Your function should return a boolean value. Remember that you can use the `test()` method for this. </ins> # --hints-- <del> You should declare a `regex` variable in your `highPrecedence` function. </del> <ins> You should declare a variable in your `highPrecedence` function for your regex. </ins> ```js <del> assert.match(code, /consts+highPrecedences*=s*((s*strs*)|str)s*=>s*{s*(?:const|let|var)s+regex/); </del> <ins> assert.match(code, /consts+highPrecedences*=s*((s*strs*)|str)s*=>s*{s*(?:const|let|var)s+w+/); </ins> ``` <del> You should use `const` to declare your `regex` variable. </del> <ins> You should use `const` to declare your regex variable. </ins> ```js <del> assert.match(code, /consts+highPrecedences*=s*((s*strs*)|str)s*=>s*{s*consts+regex/); </del> <ins> assert.match(code, /consts+highPrecedences*=s*((s*strs*)|str)s*=>s*{s*consts+w+/); </ins> ``` <del> Your `regex` variable should be a regular expression. </del> <ins> Your regex variable should contain a regular expression. </ins> ```js <del> assert.match(code, /consts+highPrecedences*=s*((s*strs*)|str)s*=>s*{s*consts+regexs*=s*//); </del> <ins> assert.match(code, /consts+highPrecedences*=s*((s*strs*)|str)s*=>s*{s*consts+w+s*=s*//); </ins> ``` <del> Your highPrecedence should return `regex.test(str);` </del> <ins> Your `highPrecedence` function should return a boolean value. </ins> ```js <del> assert.match(code, /returns+regex.test(str);?/); </del> <ins> assert.isBoolean(highPrecedence("12*2")); </ins> ``` <del> Please enter a properly functioning regex. </del> <ins> Your `highPrecedence` function should correctly check if the string matches the pattern of a number followed by a `*` or `/` operator followed by another number. </ins> ```js <del> assert.strictEqual(highPrecedence("5*3"), true); </del> <ins> assert.isTrue(highPrecedence("5*3")); assert.isFalse(highPrecedence("5")); assert.isTrue(highPrecedence("10/2")); assert.isFalse(highPrecedence("*")); </ins> ``` # --seed--