title: How to remove all non-alphabet characters, javascript
body: <p>I am asked to check if a string is a Palindrome.
  To not be case sensitive. To ignore all characters that are not letters.</p>
  
  <p><strong>My Answer</strong></p>
  
  <pre><code> function palindrome(str) {
    var oldStr = str.toLowerCase().replace(/\s+|\,|\.|\_|\-|\:|\(|\)|\/|\\/g,  '');
  
    var newStr = str.replace(/\s+|\,|\.|\_|\-|\:|\(|\)|\/|\\/g, '').split("").reverse().join("").toLowerCase();
  
    if ( oldStr === newStr){
      return true;
    }
    else {
      return false;
    }
  }
  palindrome("ininiNI");
  </code></pre>
  
  <p>The function is to be checked with any string possibility.
  <em>Example:</em> ("0_0 (: /-\ :) 0-0") Which according to the requirements should return true.</p>
  
  <p>I could not find a better solution in JavaScript then the one above.</p>
  
  <p>Is there a faster/better way than just writing out each possible character to be removed/replaced? (especially since what I wrote is far from exhaustive...)</p>