title: JavaScript error: "val.match is not a function"
body: <p>I’m using the <code>match</code> function with a Regular Expression.</p>
  <p>The code I’m using is:</p>
  <pre class="lang-js prettyprint-override"><code>if(val.match(/^s+$/) || val == &quot;&quot; )
  </code></pre>
  <p>However, it produces the following error:</p>
  <blockquote>
  <pre class="lang-none prettyprint-override"><code>&quot;val.match is not function&quot;
  </code></pre>
  </blockquote>
  <p>What is the problem?</p>