DEV Community

Cover image for 9. Palindrome Number - JavaScript Solution - by Abu Saleh Faysal
Abu Saleh Faysal
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.


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(""));
Enter fullscreen mode Exit fullscreen mode

If you want me to publish more posts like this, Buy me a coffee.

πŸ‘‰ YouTube Channel Link:
πŸ‘‰ PlayList Link:

πŸ‘‰ Connect with me (LinkedIn):
πŸ‘‰ Follow our LinkedIn Page:
πŸ‘‰ Like our Facebook page:
πŸ‘‰ Join our community (Facebook group):
πŸ‘‰ Follow me at:
πŸ‘‰ Twitter:

πŸ‘‰ Abu Saleh Faysal’s Blog:
πŸ‘‰ Hasnode:
πŸ‘‰ Dev Community:
πŸ‘‰ freeCodeCamp:
πŸ‘‰ Medium:

πŸ‘‰ GitHub:
πŸ‘‰ GitLab:

Latest comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.