Leetcode 9: Palindrome Number (JS)

Tish Faroul
Jun 27, 2022

--

Solution:

//change the number to a string and reverse
//to string will have to be split and joined back together
// then, we have to compare it to the original string
var isPalindrome = function(x){ return x.toString().split("").reverse().join("") === x.toString()};

✨✨✨And that’s it!

Tish⚡️🎧🌙

--

--