How can we use prompt command in this


var a = prompt("enter");
var sample = function(a)
while(a < 5){
a= a + 1;


What do you want to do here. One problem with this code is that prompt always returns a string so if you enter let's say 0 then prompt will turn it to "0" so when you add one to it it will not be 1 but "01" -> "011" ->"0111" aso. So perhaps using parseInt or parseFloat would be necessary.


so what is the sol.?
i want something which i ask in promt command and use it in the condition?


Maybe some sort of password?

x = prompt(...);
while(x !== ...){
   x = prompt(...);