Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


how to do a while loop base on user input

Ren SosaRen Sosa Member Posts: 8

I need to write program that prompts the user for a number and then use a While Loop to count up to the number. So if the user enters 3 the program will output the numbers 1,2,3. If the user enters 7 then the program will output numbers from 1-7

var num=prompt ("Enter a number")
while (num !==1||num !==2||num !==3)

this is the code but it is not working.


Sign In or Register to comment.