title: Catch error not work in javascript
body: <p>Y this code doesn't work with me? , i did all steps , so any one plz tell me where is my fault , and thank u</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;script&gt;
  function myFunction()
   {
      try
      {
          var x=document.getElementById("demo").value;
          if(x=="")    throw="empty";
          if(isNaN(x)) throw"not a number";
          if(x&gt;10)     throw"too high";
          if(x&lt;5)      throw"too low";
      }
      catch(err)
      {
          var y=document.getElementById("mess");
          y.innerHTML="Error:" + err + ".";
      }
  }
  &lt;/script&gt;
  &lt;h1&gt;My First JavaScript&lt;/h1&gt;
  &lt;p&gt;Please input a number between 5 and 10:&lt;/p&gt;
  &lt;input id="demo" type="text" /&gt;
  &lt;button type="button" onclick="myFunction()"&gt;Test input&lt;/button&gt;
  &lt;p id="mess"&gt;&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>