尝试让我的if警报给予if或else警报,但它们不起作用。我已经尝试了几种方法。
我试着重构它。我也把它简单地写为“if(no)”和“if }else{”,但什么也没做。
<script>
function contact() {
let name = prompt("What is your full name?");
let email = prompt("what is your email?");
let inquire = prompt("Have you done yoga before?");
if (inquire === no) {
alert(
`We're glad you chose us to start your journey ${name},we'll be in touch soon!`
);
} else {
alert(
`We can't wait to practice with you ${name}, we'll be in touch soon!`
);
}
}
let contactButton = document.querySelector(".contactButton");
contactButton.addEventListener("click", contact);
</script> here
1条答案
按热度按时间toe950271#
也许你需要修改这一行:
if(inquire ===“no”){