In this article we will look at the simplest solution to check if a number is palindrome in JavaScript.
We essentially need to transform the number into a string and compare that string to its reversed version. If the two strings are equal, the number is palindrome.
'use strict';
const isPalindrome = (num = 1) => {
const str = '' + num;
const rev = str.split('').reverse().join('');
return str === rev;
};