I’m working through the cash register app at the moment.
I’m having difficult ticking off the criteria from the test.
I’m trying to complete the alert section. I cannot complete it despite believing I have hit all of the criteria.
When price is 20 and the value in the #cash element is 10 , an alert should appear with the text "Customer does not have enough money to purchase the item" .
In my test, price is 20, the value in cash input is 10 and the alert triggers. But doesn’t pass the test.
I do have price as a global value. Admittedly, it is further down the page and not well organised.
I have changed cid to ‘let’.
I have changed the script tag. Stupidly, I have already made this mistake once before.
I have also gotten rid of the formatting of #cash.value to get rid of ‘$’ and any decimals to better match the test - #cash element is 10
For some reason I’m unable to upload a photo of my debugging but when testing the value of price and cash before and after inputting values, it updates correctly:
I would really discourage negative self-talk like this. Programming is hard and we all make mistakes, sometimes the same mistake many times. Go easy on yourself, it’s not stupid, this is just what it’s like to learn.
You are on freeCodeCamp pushing yourself to learn computer programming yourself, that proves that you’re smart and hard working.
"Students that reported using positive self-talk exclusively during those 30 seconds were able to hold their balance a full second longer than those who used exclusively negative or had a mix of both negative and positive self-talk.
The positive self-talk resulted in an average balance time of 9.29 seconds, while the other two groups averaged out at 8.29 seconds. This is more than an 11% increase in performance"