在HTML中的JS上,我无法在提示查询收到答案后弹出“if”警报

az31mfrm  于 2023-04-27  发布在  其他
关注(0)|答案(1)|浏览(79)

尝试让我的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
toe95027

toe950271#

也许你需要修改这一行:

if (inquire === no) {

if(inquire ===“no”){

相关问题