title: Find and highlight word in text using JS
body: <p>I'm new in Javascript. I have a question: how to highlight word in text, which is typed in input. I could only done part which check if this word is in text, but could not highlight this word in text. Thanks everyone in advance!</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>   var paragraph = document.getElementById('paragraph').innerText; //PARAGRAPH
          input = document.getElementById('typed-text').value; //TYPED TEXT
          textIncludes = paragraph.includes(input); // TEXT INCLUDES WORD
      
      
      if (textIncludes === true) {
          alert('Word has been found')
      } else {
          alert('No matches found')
      }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;div id="highlights"&gt;
              &lt;div class="container"&gt;
                  &lt;div class="row"&gt;
                      &lt;div class="col-md-12" id="paragraph"&gt;
                          &lt;p&gt;
                              Robotics is an interdisciplinary branch of engineering and science that includes mechanical engineering, electronics engineering, information engineering, computer science, and others. Robotics deals with the design, construction, operation, and use of robots, as well as computer systems for their control, sensory feedback, and information processing.
                              These technologies are used to develop machines that can substitute for humans and replicate human actions. Robots can be used in many situations and for lots of purposes, but today many are used in dangerous environments (including bomb detection and deactivation), manufacturing processes, or where humans cannot survive (e.g. in space). Robots can take on any form but some are made to resemble humans in appearance. This is said to help in the acceptance of a robot in certain replicative behaviors usually performed by people. Such robots attempt to replicate walking, lifting, speech, cognition, and basically anything a human can do. Many of today's robots are inspired by nature, contributing to the field of bio-inspired robotics.
                              The concept of creating machines that can operate autonomously dates back to classical times, but research into the functionality and potential uses of robots did not grow substantially until the 20th century.[1] Throughout history, it has been frequently assumed that robots will one day be able to mimic human behavior and manage tasks in a human-like fashion. Today, robotics is a rapidly growing field, as technological advances continue; researching, designing, and building new robots serve various practical purposes, whether domestically, commercially, or militarily. Many robots are built to do jobs that are hazardous to people such as defusing bombs, finding survivors in unstable ruins, and exploring mines and shipwrecks. Robotics is also used in STEM (science, technology, engineering, and mathematics) as a teaching aid.
                              Robotics is a branch of engineering that involves the conception, design, manufacture, and operation of robots. This field overlaps with electronics, computer science, artificial intelligence, mechatronics, nanotechnology and bioengineering.
                          &lt;/p&gt;
                      &lt;/div&gt;
                      &lt;div class="col-md-12 input-group mt-3"&gt;
                          &lt;div class="input-group-prepend"&gt;
                              &lt;span class="input-group-text" id="basic-addon1"&gt;
                                  &lt;i class="fas fa-pencil-alt"&gt;&lt;/i&gt;
                              &lt;/span&gt;
                          &lt;/div&gt;
                          &lt;input id="typed-text" type="text" class="form-control" placeholder="Type text"&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>