title: Javascript alert based on prompt value
body: <p>I am trying to make a script in which a prompt window will pop up asking a question, and based on what the answer in it is, an alert box will pop up saying that the answer is valid or invalid. In my code, my prompt box works, but my alert box didn't. Can someone help me solve this problem please? Thank you so so much!!</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
  &lt;script type="text/javascript"&gt;
  var City=prompt("Enter your city", "City");
  function checkName(){
      var validLetters=/^[a-z]+$/i;
      if(validLetters.test(City))
          alert("Your input is accepted!");
      else
          alert("Your input is invalid!");
  }
  &lt;/script&gt;
  </code></pre>