Answers for "palindrom numbers checkcases test cases"

C++
-1

check if palindrome

function isPalindrome(str) {
  str = str.toLowerCase();
  return str === str.split("").reverse().join("");
}
Posted by: Guest on August-17-2020
0

check for palindromes

function palindrome(str) {
  var re = /[\W_]/g;// representing Non-alphanumetic characters
  var lowRegStr = str.toLowerCase().replace(re, '');
  var reverseStr = lowRegStr.split('').reverse().join(''); 
  return reverseStr === lowRegStr;
}
palindrome("A man, a plan, a canal. Panama");
Posted by: Guest on March-25-2022

Browse Popular Code Answers by Language