How to print sum of a user input in JavaScript loops?
Hi I want something like this var one= prompt("Please enter a number"); var two= prompt("Please enter a number"); var sum = one+ two for(i = 1; i<= sum; i++){ document.write(sum) } in this case, I want to get two inputs from the user and sum these numbers together Examples: the user enters 5 in the first input the user enters 5 in the second input I want the Result of Sum of them to be in a for loops or while loops I don't know which one is better the result on the screen should be like this 1 2 3 4 5 6 7 8 9 10 as you see we have two inputs (5 and 5) and sum of both inputs should be a variable in for loop if i is < or = sum you should add one number to i variable I hope I've explained my goal