Just trying to figure out why the following code is an infinite loop?
var x = prompt("enter a number");
while (isNaN(x)){
    prompt("please enter a number");
}
All I wanted to do was to keep asking the user to enter a valid number until she does so.
                        
Because you're not updating
xwithin the loop:Note that this is one of those places a
do-whileloop is useful:Also note that
xwill be a string.isNaNwill work with it, though, because the first thing it does is try to convert its argument to a number if it's not one. But note thatxremains a string and so (for instance)+may not do what you expect. So you might convert it using a unary+,Number(),parseInt, orparseFloat. (See this answer for details on those options.) Example: