From 2e9e42c74e865f8cf0e7baebb372fcc5a5b005c4 Mon Sep 17 00:00:00 2001 From: Anna Date: Mon, 29 Jul 2024 22:14:11 -0400 Subject: [PATCH] fix(curriculum): update step 74 spreadsheet directions (#55667) --- .../646d404259f512c1a9e86ac1.md | 40 +++++++------------ 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md index 59e5ad6294e..d6f5b2b5962 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md @@ -6,53 +6,43 @@ dashedName: step-74 --- # --description-- +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. -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. +Your function should return a boolean value. Remember that you can use the `test()` method for this. # --hints-- - -You should declare a `regex` variable in your `highPrecedence` function. +You should declare a variable in your `highPrecedence` function for your regex. ```js - -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*(?:const|let|var)\s+regex/); - +assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*(?:const|let|var)\s+\w+/); ``` -You should use `const` to declare your `regex` variable. +You should use `const` to declare your regex variable. ```js - -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex/); - +assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+\w+/); ``` -Your `regex` variable should be a regular expression. +Your regex variable should contain a regular expression. ```js - -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\//); - +assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+\w+\s*=\s*\//); ``` -Your highPrecedence should return `regex.test(str);` +Your `highPrecedence` function should return a boolean value. ```js -assert.match(code, /return\s+regex\.test\(str\);?/); - +assert.isBoolean(highPrecedence("12*2")); ``` -Please enter a properly functioning regex. +Your `highPrecedence` function should correctly check if the string matches the pattern of a number followed by a `*` or `/` operator followed by another number. ```js - -assert.strictEqual(highPrecedence("5*3"), true); - +assert.isTrue(highPrecedence("5*3")); +assert.isFalse(highPrecedence("5")); +assert.isTrue(highPrecedence("10/2")); +assert.isFalse(highPrecedence("*")); ``` # --seed--