Learn Form Validation by Building a Calorie Counter - Step 33

Tell us what’s happening:

Hello. There is a problem in my code. Please help me. Here is a little about it: Sorry, your code does not pass. You’re getting there.

You should replace the [0-9] character class before e with \d in your regular expression. // running tests

  1. You should replace the [0-9] character class before e with \d in your regular expression.
  2. You should replace the [0-9] character class after e with \d in your regular expression.
    // tests completed

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

function isInvalidInput(str) {    
    const regex = /[0-9]+e\d+/i;
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 OPR/114.0.0.0

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 33

Replace both instances of [0-9] in your code.

1 Like

Please explain why you think you completed this part

1 Like

Yesterday, I completed a number of test tasks. However, by the end of the day, I was feeling tired and perhaps that’s why I didn’t finish the last task completely. As a result, I didn’t replace the variables as I intended.

The task required me to replace the character class “0-9”, which represents any digit, with the abbreviated form “\d”. However, the code provided in the task already used “\d” to indicate numbers after the letter “e”, so I thought it didn’t need to be changed. If there were two instances of “0-9” in the code, I would have replaced them with “\d”, but since it had already been done correctly, my code remained unchanged. But now, when I read the assignment and your comments and advice again with fresh, not tired brains, I realized that I was wrong and mistaken. When you do a lot of tests in one day, your attention can become blunted at the end of the day. Seemingly irrefutable truths can lose their meaning, and important details can be overlooked due to fatigue. This is because of the distraction caused by ordinary fatigue. In psychology, there is a concept called “overwork”. This is how psychologists describe the state when fatigue leads to a decrease in attention. Stress, lack of sleep, and accumulated fatigue deplete the body’s resources, making it take longer and longer to recover each time. This can lead to difficulty forming coherent sentences and logical thinking. Overwork also causes forgetfulness and a reduced ability to pay attention to details.
To minimize the effects of fatigue on attention, some recommendations include:

  • Reducing distractions in the environment
  • Taking short breaks during prolonged periods of concentration
  • Getting enough sleep each night, as chemicals that affect attention are replenished during sleep
    If the decreased level of attention persists and is not due to ordinary circumstances, it may be worth consulting a specialist.

Thank you very much.

1 Like