Skip to content

Instantly share code, notes, and snippets.

@qodirovshohijahon
Created February 6, 2020 07:55
Show Gist options
  • Save qodirovshohijahon/78e0ec5b06facdf198d07f5fc01b409e to your computer and use it in GitHub Desktop.
Save qodirovshohijahon/78e0ec5b06facdf198d07f5fc01b409e to your computer and use it in GitHub Desktop.
In this example you can see to check given number wether pali or not.
/**
* @param {number} x
* @return {boolean}
*/
var isPalindrome = function(x) {
let str = "";
let digit = x.toString();
for(let i = digit.length - 1; i >= 0; i-- ) {
str += digit[i];
}
str = Number(str);
return x == str ? true : false;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment