mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): check position of if statement - calorie counter New JS Project (#55317)
This commit is contained in:
+7
-7
@@ -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--
|
||||
|
||||
Reference in New Issue
Block a user