Do I need to assign new random to youHit?


#1


Hello everyone.

I was surprised to read that I have to assign a new random to youHit variable. Why should I do it if that variable had already assigned value and nothing in the code change that? Or at least I can't see where something is changing it. I would be very grateful for explanation.

https://www.codecademy.com/courses/javascript-beginner-en-mrTNH-6VIZ9/0/5?curriculum_id=506324b3a7dffd00020bf661


Replace this line with your code.


#2

youHit gives you a 50% to hit, so after the first hit, you again want to determine if the user hits successful or not (another 50% change)


#3

Even after your answer it took a while to get it, but finally I got it. Without second assingment I would always have a hit or always a miss. Thanks a lot!


#4

exactly, you understand :slight_smile: