title: JavaScript : Search bar taking into consideration order of letters
body: <p>it's my first post in stackOverflow (don't be monsters please hehe). I'm looking for advice or tips for a function for a search bar. I already using this: </p>
  
  <pre><code>    for (i = 0; i &lt; taskButton.length; i++) {
      //if there is a match 
          if (tasks[i].toUpperCase().indexOf(filter) &gt; -1) {
          //display the match
            taskButton[i].style.display = "";
          } else {
            //hide the mismatch
            taskButton[i].style.display = "none";
          }
      }
  </code></pre>
  
  <p>But with indexOf, is there is a space character in the string, for example, it will show all the strings with a space. I want to improve this search function taking into consideration the order of each letter.
  Thank you per advance guys ! </p>