title: Javascript function return
body: <p>I need to check if the name field is only Hebrew letters[א-ת],
  now the function work good, but if I enter letters from two different languages like "abcdאבג" it ignores and return true and I need it to return false,
  thank you</p>
  
  <pre><code>function justHeb(str){
      ok = true;
          for (var i=0;i&lt;str.length&amp;&amp;ok;i++)
          {
              if (!str[i].match(/[א-ת]/))
              {
                  ok=false;
                  return false;
              }
              else return true;
          }
  }
  
  function firstName(str){
      if(justHeb(document.getElementById("firstname").value)){
          return true;
      }
      else {
          return false;
      }
  }
  
  function checkAll(){
      if(firstName()){
          alert("true");
      }
      else 
          alert("false");
  }
  </code></pre>