diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c2164c0df38a382062c4af.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c2164c0df38a382062c4af.md index 7d8d3ab5504..5b28bc2db41 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c2164c0df38a382062c4af.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c2164c0df38a382062c4af.md @@ -9,7 +9,7 @@ dashedName: step-45 Each entry will have a text input for the entry's name, and a number input for the calories. To get a count of the number of entries, you can query by text inputs. -Pass the string `input[type="text"]` to the `querySelectorAll()` method. Remember that you will need to use single quotes for your string, so that you can use double quotes within. +Pass the string `input[type="text"]` to the `querySelectorAll()` method. Remember that if you use single quotes for your string, you must also use double quotes within it (or vice-versa). This will return a `NodeList` of all the text inputs in the form. You can then access the `length` property of the `NodeList` to get the number of entries. Do this on the same line. @@ -18,19 +18,19 @@ This will return a `NodeList` of all the text inputs in the form. You can then a You should pass the string `input[type="text"]` to the `querySelectorAll()` method. ```js -assert.match(addEntry.toString(), /entryNumber\s*=\s*targetInputContainer\.querySelectorAll\(\s*'\s*input\s*\[\s*type\s*=\s*"text"\s*]\s*'\s*\)/) +assert.match(addEntry.toString(), /entryNumber\s*=\s*targetInputContainer\.querySelectorAll\(\s*("|')\s*input\s*\[\s*type\s*=\s*("|')text\2\s*]\s*\1\s*\)/) ``` You should access the `length` property of your `querySelectorAll()`. ```js -assert.match(addEntry.toString(), /\.querySelectorAll\(\s*'\s*input\s*\[\s*type\s*=\s*"text"\s*]\s*'\s*\)\.length/) +assert.match(addEntry.toString(), /\.querySelectorAll\(.*\)\.(?=(length))(\1$|\1\s*;)/) ``` Your `entryNumber` variable should be the `length` of the `querySelectorAll`. ```js -assert.match(addEntry.toString(), /entryNumber\s*=\s*targetInputContainer\.querySelectorAll\(\s*'\s*input\s*\[\s*type\s*=\s*"text"\s*]\s*'\s*\)\.length/) +assert.match(addEntry.toString(), /entryNumber\s*=\s*targetInputContainer\.querySelectorAll\(\s*("|')\s*input\s*\[\s*type\s*=\s*("|')text\2\s*]\s*\1\s*\)\.(?=(length))(\3$|\3\s*;)/) ``` # --seed--