JS help with loop
I read around the forum before posting anything, and I seemed to get some answers that I needed for other assignments. I guess I should start with a short intro.
So for the code I need help with now, its the loop that I am having problems with. I have to use 'while loop' but unfortunately my text book is limited in explaining how to properly use it. The code below is what I have.
Essentially its a hi-lo game. I need to be able to let the user choose a number between 1-1000 and the game (which will choose the random number using Math.random) will let the user know if they have to go higher or lower.
I can get higher to work, but as soon as lower is prompted and entered, it ends the script. I think its because I have no loop, so its just ending the page as it stands. If anyone can advise me on how to get the while loop to work, that would be excellent!
I do appreciate all the work anyone can do to assist me!
Here you are. Please study and learn from it.
It is not really in your best interests that others do your all or most homework for you. Your teacher may gain a false and exaggerated idea of your programming capabilities and so not offer you the support you need. Also, if you hand in other people's work which you do not completely understand, then you will start to fall behind and your difficulties will increase.
It is your responsibility to die() if necessary….. - PHP Manual
Thank you for the response and code. As for your tidbit at the end - I could not agree more!
I also have a networking class that I was somewhat struggling with about a month ago. I got my boss at work (who took the program a few years back) to draw me a diagram of the OSI and TCP/IP layers to better explain it and now I understand better.
I do appreciate your assistance, and I will review the code thoroughly. It would be rather useless to just copy and paste other peoples code because eventually, when I get into the workplace, I am going to need to understand how to do these codes.
I do thank you again for helping me out!
|All times are GMT +1. The time now is 11:36 AM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.