WhileLoop Refresh Browser

MonetishMonetish Texas
edited December 2015 in JavaScript

Hello all,

I'm fairly new to JavaScript but this has me stumped and curious.

When I'm writing my code and I keep my browser open to check it, as I change/update things in my code I refresh to see the changes.

I just started learning about For Loops and WhileLoops.

When I write a while loop that is executed on the page it will not allow me to refresh the browser to start over with my code. I have to push back and refresh or exit and reopen. Do you know what the reason for this is?
(Also my while loop is within a function that is called by an input / button)

Is it not refreshing because of the function execution or the while loop?

The code itself is running fine and giving me the correct output.

Just curious to this refreshing the page after executing the code situation. It's like the page is stuck on the answer/output page.

Thanks in advance for educating me on why this is,


  • WillHWillH Dallas, TX

    Could you include the code please? When I run the following code, my program simply begins again when I hit refresh.

    var x=prompt("Enter A Number: "); function numloop(x) { var i=1; while (i<=x) { document.write(i+"<br/>"); i++; } }


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion