title: Abbreviate check function
body: <p>I'm just starting to learn javascript and i'm trying to figure out how to make this code shorter.
  Right now, the check function evaluates if a = &quot;admin&quot; and after that if a = &quot;manager&quot;.
  Is it possible to do this evaluation in one line?
  Kind of &quot;<em>if (a = &quot;admin&quot; or &quot;manager&quot;)</em> ...&quot;</p>
  <pre><code>const valid = &quot;User name valid&quot;;
  const invalid = &quot;User name invalid&quot;;
  function check(a, b) {
    if (a === &quot;admin&quot;) {
      return valid;
    } else if (a === &quot;manager&quot;) {
      return valid;
    } else if (b[0].toUpperCase() == b[0] &amp;&amp; b.length &gt; 4 &amp;&amp; b.length &lt; 10) {
      return valid;
    } else {
      return invalid;
    }
  }
  console.log(check(&quot;manager&quot;, &quot;ikey&quot;));
  console.log(check(&quot;admin&quot;, &quot;root&quot;));
  console.log(check(&quot;user&quot;, &quot;ikey&quot;));
  console.log(check(&quot;user&quot;, &quot;Mikey&quot;));
  </code></pre>
  <p>Thanks!!</p>