title: JavaScript - How to add bold/strong effect to certain words in a given String
body: <p>I'm trying to highlight certain keywords inside a <code>string</code> (these keywords passed as strings in an array). So far I'm able to find where these words start, but I can't obviously surround them with <code>&lt;b&gt;&lt;/b&gt;</code> tags. Any ideas?
  JSfiddle example <a href="http://jsfiddle.net/ot6fznoy/" rel="nofollow">here</a>.</p>
  
  <p>JS:</p>
  
  <pre><code>function getIndicesOf(searchStr, str) {
      var startIndex = 0;
      var index, tmp = [];
  
      while ((index = str.indexOf(searchStr, startIndex)) &gt; -1) {
          tmp.push(index);
          startIndex = index + searchStr.length;
      }
      console.log(tmp);
  }
  
  var vow = "Night gathers, and now my watch begins..";
  var bold=["night","watcher"];
  for(var i=0;i&lt;bold.length;i++){
      getIndicesOf(bold[i], vow);
  }
  
  document.getElementById("vow_p").innerHTML = vow;
  </code></pre>