Advertisement
Spocoman

05. Palindrome Integers

Jan 28th, 2022
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve (numbers) {
  2.  
  3.     while (numbers.length !== 0) {
  4.         let result = 'true';
  5.         let input = numbers.shift().toString();
  6.  
  7.         for (let i = 1; i <= input.length / 2; i++) {
  8.             if (input[i - 1] !== input[input.length - i]) {
  9.                 result = 'false';
  10.                 break;
  11.             }
  12.         }
  13.         console.log(result);
  14.     }
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement