var model = prompt("What is the model of your car?");
while(model == '')
{
var model = prompt("What is the model of your car?");
}
alert("My model is " + model);
4 Responses
Ok, se me ocurre algo que algo así funcionaria:
var model;
do{
model = prompt("What is the model of your car?");
if(model){
alert("My model is " + model);
}
}while(model == '');
Ese método también funcionaria, la verdad es que estoy apenas en mis inicios en javascript y me extraña mucho no encontrar una función como la de empty() en PHP.
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.
4 Responses
var model;
do{
model = prompt("What is the model of your car?");
if(model){
alert("My model is " + model);
}
}while(model == '');
while (x==null || x==""){...}
Write a comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.