The program is required to terminate if 0 is entered, otherwise it will keep going. If 0 is entered i need to print to the console the largest value entered. Need some help fixing this code. it doesn't always print the largest number entered. Sometimes it does.
var number = 1;
var largest = 0;
do {
number = prompt("Enter a number other than 0 and will tell you the largest");
if(number >= largest) { //If largest is small, set current number
as largest
largest = number;
}
} while (number > 0);
console.log("The largest number is " + largest);