fix(curriculum): update step 74 spreadsheet directions (#55667)

This commit is contained in:
Anna
2024-07-29 22:14:11 -04:00
committed by GitHub
parent ac94a0bf22
commit 2e9e42c74e

View File

@@ -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--