title: Using indexOf() in JS - is it wise to negate null values and how?
body: <p>When searching through an array how do we deal with white spaces? Do we say a search returns false if the user types in nothing (i.e. just presses enter) or types in a blank space? </p>
  
  <pre><code>test_pages=[
  "Lorem Ipsum is simply dummy text of the printing and typesetting industry."
  , 
  "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout", 
  "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable." 
  ]
  
  var find=prompt("Enter a term");
  find = find.toLowerCase();
  
  for(i=0;i&lt;test_pages.length;i++)
      {   
          // normalisation
          test_pages[i] = test_pages[i].toLowerCase();
  
          // use indexOf() to find the occurrences of pattern
          if(test_pages[i].indexOf(find)&gt;=0)
          {
              alert("true");
              break;
          }
          else if(test_pages[i].indexOf(find)&lt;0)
          {
              alert("false");
          }    
      }
  </code></pre>