Use a prompt("Give me your favorite numbers")
method to accept number from user and put them to array variable called favorite_numbers
until the user enters 0. The program stops asking and exits after the user enters 0.
What is expected
By going through this problem, you will perfectly understand the usage of do.. while
looping in that there is a need at least to ask for the number at least one time. It can also be done with while of course, but do..while
is the perfect one for this.
Hint: you will need to use .push method to add the numbers to the array. It is advisable to use parseInt()
method to convert the accepted values to numbers also.