Lulunga

Palindrome

Jun 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. function solve(input) {
  2. for (let num of input){
  3. console.log(isPalindrom(num));
  4. }
  5.  
  6. function isPalindrom (num) {
  7. let numAsString=num.toString();
  8. for (let i=0; i<numAsString.length/2; i++) {
  9. if (numAsString[i]!==numAsString[numAsString.length-1-i]) {
  10. return false;
  11. }
  12. }
  13. return true;
  14. }
  15. }
Add Comment
Please, Sign In to add comment