diff --git a/Javascript/9_Palindrome_Number.js b/Javascript/9_Palindrome_Number.js new file mode 100644 index 00000000..ff941cfe --- /dev/null +++ b/Javascript/9_Palindrome_Number.js @@ -0,0 +1,13 @@ +/* + * https://leetcode.com/problems/palindrome-number/ + */ + +/** + * @param {number} x + * @return {boolean} + */ + var isPalindrome = function(x) { + let arrayNum = Array.from(String(x), x => Number(x)) + + return parseInt(arrayNum) === parseInt(arrayNum.reverse()) +};