I tried a lot to get out of this step but all in vain
help to solve that
Number inputs only allow the e
to occur between two digits. To match any number, you can use the character class [0-9]
. This will match any digit between 0
and 9
.
Add this character class before and after e
in your pattern.
function isInvalidInput(str) {
const regex = /[0-9]/i;
}
code link:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-form-validation-by-building-a-calorie-counter/step-32