Question: How to continuously prompt user when age is invalid (below 0 above 200, or not-a-number)?       var userAge = prompt("Please enter your age"); while (isNaN(userAge)){     alert("That's not a number, please retry.");...
This question already has answers here:...
The while loop  Test the condition and if it is true, then execute the code  The do..while loop  Execute first time. Then test and execute.  So the difference between while and do..while is , programmatically In while, one test is carried out more th...
I have an image gallery which pulls in random images from the folder images/flip_images/. The files are names as a number then .jpg, e.g. 0.jpg, 1.jpg etc. There are 14 images which it can choose from, labelled 0 - 13. As there are only 14 images and...
I'm learning JavaScript. I just learned do while loop and tried to do some example.  this is the code what I made...  for (i=0; i<5; i++) {     console.log ("for loops " + i); } do {     console.log ("do once"); } while (i<8...
A simple straight forward game user enters 6 numbers and clicks button play, if all 6 numbers are matched they win lottery, I have set up the loop so that it keeps generating a random numbers until the user wins, then informs them the number of loops...
I'm attempting to make a function wherein I console.log a phrase when the number is between 0-10.  I'm getting it to print out the phrase 10 times, but to get it to pass the testing platform, I need to print it out when the number is 0, and i...
I'm practicing with regular expressions. I found a great answer here on StackOverflow:  How do I retrieve all matches for a regular expression in JavaScript?  I copied the code from the checked answer and pasted it into an editor and then wrote m...
So i have this code that i want to be able to limit what can be said in a prompt box using javascript. I am using a do and while statement to push out a prompt loop until the prompt meets the requirement, i am only allowed to use javascript. I want t...
function reachOne(integer) {       //deal with errors in input       var array = [];       //initialize multiply by putting it equal to 1       var multiply = 1;       var count = 0;        if (integer < 0) {           document.write('Do it...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.