title: Why does indexOf work different when using as is vs comparing it to -1?
body: <p>Can't seem to find an answer probably due to my lack of googling experience and the mozilla page of indexOf doesn't seem to answer it</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>//this returns -1 because it can't find 'ca' within cat
  var randomArr = ['dog', 'cat', 'bird', 'cheetah'];
  console.log(randomArr.indexOf('ca'));
  
  //this returns 1 which is correct, but why?
  var randomArr = ['dog', 'cat', 'bird', 'cheetah'];
  for (var i = 0; i &lt; randomArr.length; i++) {
    if (randomArr[i].indexOf('ca') !== -1) {
      console.log(i);
    }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>I don't why this works differently when using indexOf. Why does it need an exact string match in one case but not the other?</p>