How to check if string is palindrome ignore case in TypeScript

1 Answer

0 votes
function isPalindrome(str : string) {
    return str.toLowerCase() === str.toLowerCase().split('').reverse().join('');
}

const str : string = "typescripttpircsePyT"
  
console.log(isPalindrome(str));
     
     
          
  
/*
  
run:
  
true
  
*/
     

 



answered Nov 12, 2022 by avibootz
...