title: Unwrap all images from HTML string in pure javascript
body: <p>How can I unwrap all the images from an HTML string without using jQuery?</p>
  
  <pre><code>var htmlString = `
              &lt;p&gt; random text &lt;/p&gt;
              &lt;a href="src1"&gt;&lt;img src="src1"/&gt;&lt;/a&gt;
              &lt;a href="src2"&gt;&lt;img src="src2"/&gt;&lt;/a&gt; 
              &lt;a href="src3"&gt;&lt;img src="src3"/&gt;&lt;/a&gt;
              &lt;p&gt; random text &lt;/p&gt;
             `;
  
  var div = document.createElement('div');
  div.innerHTML = htmlString;
  
  var elements = div.getElementsByTagName("img");
  let i = 0;
  while (i &lt; images.length) {
     //unwrap all images from parent in pure javascript 
     images[i] ....
  }
  
  console.log(div.innerHTML);
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code> &lt;p&gt; random text &lt;/p&gt;
   &lt;img src="src1"/&gt;
   &lt;img src="src2"/&gt;
   &lt;img src="src3"/&gt;
   &lt;p&gt; random text &lt;/p&gt;
  </code></pre>