Abu Saleh Faysal

Posted on

# 9. Palindrome Number - JavaScript Solution - by Abu Saleh Faysal

Checking "Palindrome number" is a very widespread problem. Compared to the other languages, I found it easier to solve this problem with JavaScript.

## Solution:

Step 01: Convert x into string using toString().
Step 02: Split the string using split().
Step 03: Reverse the string using reverse().
Step 04: Join the string using join().
Step 05: Convert the string into number using Number().
Step 06: Check whether the number is equal to the parameter x or not.

``````/**
* @param {number} x
* @return {boolean}
*/
var isPalindrome = function (x) {
return x === Number(x.toString().split("").reverse().join(""));
};
``````

π Abu Saleh Faysalβs Blog: https://abusalehfaysal.hashnode.dev/
π Hasnode: https://hashnode.com/@AbuSalehFaysal
π Dev Community: https://dev.to/abusalehfaysal
π freeCodeCamp: https://www.freecodecamp.org/abusalehfaysal
π Medium: https://abusalehfaysal.medium.com/

π GitHub: https://github.com/AbuSalehFaysal
π GitLab: https://gitlab.com/AbuSalehFaysal