0
0
pkpavan koka
The isPalindrome function takes a string as an input and checks if the string is a palindrome. It splits the string into an array of characters and checks to see if the last character in the array is equal to the first character in the array. If the strings are not equal, the function returns false.
var isPalindrome = function(x) {
let isPalindrome = true;
const arr = x.toString().split('');
const length = arr.length;
arr.forEach((el, index) => {
if(el !== arr[length - 1 - index]) {
isPalindrome = false;
}
})
return isPalindrome
};