ReutenkoIvan

polindrom

Sep 11th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const polindrom = str => {
  2.   const lastIndex = str.length - 1;
  3.   let result;
  4.  
  5.   for(let i = 0; i < lastIndex/2; i++){
  6.     result = str[i].toLowerCase() === str[lastIndex - i].toLowerCase();
  7.  
  8.     if (!result) return result
  9.   };
  10.  
  11.   return result
  12. };
Advertisement
Add Comment
Please, Sign In to add comment