title: JavaScript Check for palindrome (spaces & punctuation included)
body: <p>Trying to check for palindromes. I've checked other answers but none included punctuation &amp; spaces.</p>
  
  <p>"never odd or even" and "A man, a plan, a canal. Panama" Should return true but they don't.</p>
  
  <pre><code>   function palindrome(str) {
    if(str.replace(/[^\w\s]|_/g, "").toLowerCase() === str.replace(/[^\w\s]|_/g, "").toLowerCase().split("").reverse().join("")){
      return true;
    } else {
      return false;
    }
  }
  palindrome("eye");
  </code></pre>