I have to make a function that tests if a certain value when reversed is equal to it's original form. 
I get a positive integer a and this is the code I came up with
   var i = 0;
   var numlist1 = [];
   numlist1 = a.toString(10).replace(/\D/g, '0').split('').map(Number);
   var numlist2 = [];
   numlist2 = numlist1.reverse();
   var final=1;
   while (i<numlist1.length) {
      if (numlist1[i] != numlist2[i]) {
         final=0;
         break;
      }
      i=i+1;
   }
   var answer="yes";
   if (final == 0) {
      answer="no";
   }
however when I try using it the answer gets returned as yes, even when I input a number like 211 which is not equal to its reverse.
 
     
     
     
    