title: Compress this code
body: <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>function palindrome(str) {
    
    str = str.toLowerCase().replace(/\W/g,'');
    var subStr = str.split(""),newStr = '',anotherStr = '';
    for (var j = 0; j &lt; subStr.length;j++){
      if(subStr[j] === "_"){continue;}else{anotherStr += subStr[j];}}
    for (var i = subStr.length - 1; i &gt; -1;i--){
      if(subStr[i] === "_"){continue;}else{newStr += subStr[i];}}
    if (anotherStr === newStr) {
      return true;
    } else {
      return false;
    } 
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Can someone please help me in compressing this code?
  It worked fine, but I believe the block of codes could be reduced.</p>
  
  <p>Thanks.</p>