title: javascript check if value has at least 2 or more words
body: <p>I have a field that you enter your name in and submit it. I would like the receive peoples first and last names and to do this i need to check if the value contains at least 2 words. This is what I am using right now but it doesn't seem to work.</p>
  
  <pre><code>function validateNameNumber(name) {
      var NAME = name.value;
      var matches = NAME.match(/\b[^\d\s]+\b/g);
      if (matches &amp;&amp; matches.length &gt;= 2) {
          //two or more words
          return true;
      } else {
          //not enough words
          return false;
      }
  }
  </code></pre>