title: Getting error .append is not a function
body: <p>I am trying to split up a string on /* and then to split up those segments on */ </p>
  
  <p>So that I can separate out all of the comments as <strong>I want this code to be able to take all of the comments out of the string and then put it back together.</strong> </p>
  
  <p>The problem is though I keep getting this <code>.append</code> error which I am pretty sure is because I have made a silly syntax error but I am struggling to find it and any help would be greatly appreciated.</p>
  
  <p><strong>JS</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>contents = "if for /* else */ . = == === /* return */ function"
  
  var start = /\/\*/gi;
  var end = /\*\//gi;
  var commentsRemovedSec2 = [];
  
  var commentsRemovedSec1 = contents.split(start);
  console.log(commentsRemovedSec1);
  
  for (var i = 0; i &lt; commentsRemovedSec1.length; i++) {
    var z = ""
    var x = commentsRemovedSec1[i]
    var y = x.split(start)
    z = y[0]
    commentsRemovedSec2.append(z);
  };
  
  console.log(commentsRemovedSec2);</code></pre>
  </div>
  </div>
  </p>