Is it a palindrome? (CodeWar)

PHOTO EMBED

Tue Oct 04 2022 07:40:15 GMT+0000 (Coordinated Universal Time)

Saved by @j_jivan #javascript

// Q. Write a function that checks if a given string (case insensitive) is a palindrome.

function isPalindrome(x) {
  x = x.toLowerCase();
  for(let i = 0, j = x.length - 1; i < x.length; ++i, --j){
    if(x[i] != x[j]){
      return false
    }
  }
  return true;
}
content_copyCOPY

https://www.codewars.com/kata/57a1fd2ce298a731b20006a4/train/javascript