I wonder how to write palindrome in javascript, where I input different words and program shows if word is palindrome or not. For example word noon is palindrome, while bad
To avoid errors with special characters use this function below
function palindrome(str){ var removeChar = str.replace(/[^A-Z0-9]/ig, "").toLowerCase(); var checkPalindrome = removeChar.split('').reverse().join(''); if(removeChar === checkPalindrome){ return true; }else{ return false; } }