我对编码完全陌生,我正在尝试创建一个函数来请求用户输入,将输入存储在要动态创建的变量中,最后输出变量的转换;我的代码就在下面。谢谢:
function dogHuman(yes, no) {
var humanAge = ((dogAge - 2) * 4) + 21;
var haveDog = prompt("Do you have a dog? " + "yes" + " or " + "no");
if (haveDog == yes) {
var dogAge = prompt("How old is your dog? ");
alert("If your dog were human, it would be " + humanAge + " years old");
} else if (haveDog == no) {
alert("Thank you for you attention");
} else {
var haveDog = prompt("Do you have a dog? " + "yes" + " or " + "no" + yes + no);
}
}
dogHuman();
蝴蝶刀刀
慕丝7291255
largeQ
相关分类