Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. function gg(array)
  2. {
  3.  
  4. for (let i = 0; i < array.length; i++) {
  5.  
  6. var proterka=true;
  7. var num=array[i];
  8. num=num.toString().split("");
  9.  
  10. for (let j = 0; j < num.length; j++) {
  11.  
  12. if(num.length==1){
  13. break;
  14. }
  15. var purvacifra=num.shift();
  16. var poslednacifra=num.pop();
  17. if(purvacifra!==poslednacifra){
  18. proterka=false;
  19. break;
  20. }
  21. num.pop();
  22. num.shift();
  23.  
  24. }
  25. if(proterka===true){
  26. console.log("true");
  27. }
  28. else{
  29. console.log("false");
  30. }
  31.  
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement