Skip to content
Advertisement

Problem: While loop won’t re-run the program properly

JavaScript

Result:

JavaScript

Currently, my program will print a score depending on what the user enters. After the first input, ‘fazli’ the score was 17.

My while loop is supposed to keep running until the user enters nothing.

The problem is my while loop I believe. It won’t make a new score, it only copies the first one.

How can I keep running my while loop without it copying the first entered word score?

Advertisement

Answer

because you don’t update the score in the while loop. you have to recalculate it with each iteration. I changed it for you.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement