title: Is there a faster way to find any name in namesArray?
body: <p>Can I find a required name without loop through each array item? 
  Is there any faster way to do the same assuming that I have a very big array length, because if I have an array of 10000 items and the name doesn't exist in it, it will be a waste of time and assuming that we don't have inclouds function </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
    function binarySearch(names, requiredName) {
      for (var i = 0; i &lt; names.length; i++) {
        if (names[i] === requiredName) {
          return true;
        }
      }
      return false;
    }
    console.log(binarySearch(['ola', 'amer', 'anwar', 'mamon'], 'hadeel'));
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>