title: How to see if an array has a value, and return true if it does. - JavaScript
body: <p><em>Both arrays contain the string 'hello', but only the first logs true. Why?</em></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>function containsHello(array){
    for(let i = 0; i &lt; array.length; i++){
      if(array[i] === 'hello'){
        return true;
      } else {
        return false;
      }
    }
  }
  
  console.log(containsHello(['hello', 'no', 'yes'])); // logs true
  console.log(containsHello(['no', 'hello', 'yes'])); // logs false</code></pre>
  </div>
  </div>
  </p>