Example:
Input: x = 121
Output: true
Explanation: 121 reads as 121 from left to right and from right to left.
My code:
var isPalindrome = function(x) {
let string = x.toString();
let arr = string.split('').reverse().join('');
if (x === parseInt(arr)){
return true;
}else{
return false;
}
};