title: How can I do a js script which I get all comments in script tag
body: <p>I want to log comments in script tags in an html document. How can i do that ?</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;body&gt;
          &lt;script&gt;
          //my comment
          var test = "some js";
  
          /* start of comment
          ...
          end of comment*/
          &lt;/script&gt;
          &lt;!-- This is a comment --&gt;
          &lt;p&gt;This is a paragraph.&lt;/p&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>For now, I have this snippet of code to get all html comments </p>
  
  <pre><code>var jq = document.createElement('script');
  jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
  document.getElementsByTagName('head')[0].appendChild(jq);
  
  jQuery.noConflict();
  
  $(function() {
  $("*").contents().filter(function(){
      return this.nodeType == 8;
  }).each(function(i, e){
      console.log(e.nodeValue);
    });
  });
  </code></pre>
  
  <p>will return : This is a comment</p>