title: Write a javascript function to check whether a word or a sentence is palindrome or not irrespective of case and spaces
body: <p>Here is the problem statement.
  Write a javascript function to check whether a word or a sentence is a palindrome or not irrespective of case and spaces.
  Here is my code for checking the palindrome number but I don't know how to check for white spaces.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  
  &lt;body&gt;
    &lt;script type="text/javascript"&gt;
      function checkPalindrome() {
        var revStr = "";
        var str = document.getElementById("str").value;
        var i = str.length;
        for (var j = i; j &gt;= 0; j--) {
          revStr = revStr + str.charAt(j);
        }
        if (str == revStr) {
          alert("The entry is Palindrome");
        } else {
          alert("The entry is not a Palindrome");
        }
      }
    &lt;/script&gt;
    &lt;form&gt;
  
      Enter a String/Number: &lt;input type="text" id="str" name="string" /&gt;
      &lt;br /&gt;
      &lt;input type="submit" value="Check" onclick="checkPalindrome();" /&gt;
    &lt;/form&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I expect the output should show the results ignoring white spaces.</p>