Dragon Slayer while loop exercise

I made this for Javascript track in Code Academy (http://www.codecademy.com/tracks/javascript)