title: How to match only the exact word using indexOf or includes in JavaScript
body: <p>I want to search only the specific word in my string using javascript. But using match, indexOf  or includes are not working properly. Suppose </p>
  
  <pre><code>    let str = "Widget test";
  
     if (~str.indexOf("Widge")) {
      console.log( 'Found it!' );
      }
  </code></pre>
  
  <p>it will print found it as it is not matching the whole word only the substring. How can I return it to found if only the match is Widget</p>
  
  <p>But what I want is :</p>
  
  <p>if input string = Widget, output =  true</p>
  
  <p>if input string = Widge , output =  false</p>