How to to check if a number is a palindrome using node js

// Function to check if a number is a palindrome
function isPalindromeNumber(num) {
  const reversed = parseInt(num.toString().split('').reverse().join(''));
  return num === reversed;
}

// Example usage
const palindromeCheck = isPalindromeNumber(121);
console.log(palindromeCheck);

 

Post your Answer