提示用户输入一个大于100但小于2000的数字,并将其存储为名为user的变量。
写一条if语句,检查用户是否大于100且小于2000。
如果是,则应将message1分配给名为result的变量。如果不是,则应改为分配message2。
var user = prompt("Give me a number between 100 and 2000");
var message1 = 'You are amazingly correct!';
var message2 = 'Awww, it looks like that number is not correct. Try again!';
var result = message1;
function
if(){
console.log(result);
}
else (sonsole.log(message2));
答案 0 :(得分:0)
var user = prompt("Give me a number between 100 and 2000");
var message1 = 'You are amazingly correct!';
var message2 = 'Awww, it looks like that number is not correct. Try again!';
if(user <2000 && user >100){
console.log(message1);
}else{
console.log(message2);
}