fix(curriculum): check position of if statement - calorie counter New JS Project (#55317)

This commit is contained in:
Lasse Jørgensen
2024-07-03 06:46:26 +02:00
committed by GitHub
parent 5b62ec7137
commit 4dcef37195
@@ -11,13 +11,7 @@ Your `getCaloriesFromInputs` function will set the global error flag to `true` i
# --hints--
Your `calculateCalories` function should have an `if` statement.
```js
assert.match(calculateCalories.toString(), /if\s*\(/);
```
Your `if` statement should check the truthiness of the `isError` variable.
Your `calculateCalories` function should have an `if` statement that checks the truthiness of the `isError` variable.
```js
assert.match(calculateCalories.toString(), /if\s*\(\s*isError\s*\)/);
@@ -29,6 +23,12 @@ Your `if` statement should use `return` to end the function execution.
assert.match(calculateCalories.toString(), /if\s*\(\s*isError\s*\)\s*\{?\s*return\s*;?\s*\}?\s*/);
```
Your `if` statement should be placed after the last `getCaloriesFromInputs` function call.
```js
assert.match(code, /if\s*\(\s*isError\s*\)\s*\{?\s*return\s*;?\s*\}?\s*\}\s*function\s+/);
```
# --seed--
## --seed-contents--