Practice exercise - Loops, If-else & Boolean's

I think I misunderstood the last question, 28. While loop with input.


this is what I came up with -

var usernumber = prompt(“Give me a number”);
var outputnumber = 0
while (outputnumber < usernumber) {
outputnumber = outputnumber + 1;
alert(“are you enjoying this yet, only “+(usernumber-outputnumber)+” left to go”)

I found this amusing anyway, especially when someone enters a large number

1 Like

Hi @Jargo,

Your answer seems to align with the question. The only thing is instead of console.logging your answer you are showing it as an alert which will make your program stop at every iteration.

However, your answer to the question achieves the goal so that is enough.

Happy learning! :smile: