From 2024104e08355f5b3418fe3c96eb943b1bf1685a Mon Sep 17 00:00:00 2001
From: Zishan Panchal <36021217+zishpanchal@users.noreply.github.com>
Date: Tue, 6 Feb 2024 19:05:40 +0530
Subject: [PATCH] fix(curriculum): Update description for step 22 of calorie
counter project (#53554)
---
.../63bf45ce0dc8d4270760c6d0.md | 20 ++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf45ce0dc8d4270760c6d0.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf45ce0dc8d4270760c6d0.md
index bfc11087a26..d48f573af17 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf45ce0dc8d4270760c6d0.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf45ce0dc8d4270760c6d0.md
@@ -7,24 +7,26 @@ dashedName: step-22
# --description--
-Within your loop, you need to check if the character in `strArray` at index `i` is not a `+`, `-`, or a space. If it is not, `push` it to the `cleanStrArray`.
-
You will need to check if the array `["+", "-", " "]` does not include the current character. You can use a combination of the includes() method and the ! operator to do this.
The `.includes()` method returns `true` if the array contains the character, and `false` if not. The logical NOT operator (`!`) will return the opposite of the value of the `.includes()` method.
-Here is an example:
+Here is an example checking if the current character is not in the vowels array. If it is not, that current character is pushed into the `consonantArray`:
```js
-const numbersArray = [1, 2, 3, 4, 5]
-const number = 6
+const inputString = "Hello World";
+const charArray = inputString.split('');
+const consonantArray = [];
-if (!numbersArray.includes(number)) {
- console.log("The number is not in the array.")
+for (let i = 0; i < charArray.length; i++) {
+ if (!['a', 'e', 'i', 'o', 'u'].includes(charArray[i])) {
+ consonantArray.push(charArray[i]);
+ }
}
-
```
+Within your loop, you need to check if the character in `strArray` at index `i` is not a `+`, `-`, or a space. If it is not, `push` it to the `cleanStrArray`.
+
# --hints--
Your `for` loop should have an `if` statement.
@@ -40,7 +42,7 @@ Your `for` loop should use `!["+", "-", " "].includes()`.
assert.match(code, /for\s*\(\s*(let|var)\s+i\s*=\s*0\s*;\s*i\s*<\s*strArray\.length\s*;\s*i\s*\+\+\s*\)\s*\{\s*if\s*\(\s*!\s*\[\s*("|')\+\2\s*,\s*("|')-\3\s*,\s*("|')\s\4\s*\]\s*\.includes\(/);
```
-Your `for` loop should see if `strArray[i]` is found in `["+", "-", " "]`.
+Your `for` loop should see if `!["+", "-", " "].includes(strArray[i])`.
```js
assert.match(code, /for\s*\(\s*(let|var)\s+i\s*=\s*0\s*;\s*i\s*<\s*strArray\.length\s*;\s*i\s*\+\+\s*\)\s*\{\s*if\s*\(\s*!\s*\[\s*("|')\+\2\s*,\s*("|')-\3\s*,\s*("|')\s\4\s*\]\s*\.includes\(\s*strArray\s*\[\s*i\s*\]\s*\)\s*\)(\s*\{)?/);