0;
let right = word.length -1;
while (left < right){
if (word[left] !== word[right]){return false;
}
left++;right--;
}return true;
}
const palindromeString = "radar";const isPalindromic = isPalindrome(palindromeString);
console.log(`Is "${palindromeString}" a palindrome? ${isPalindromic}`);
Have you copied this from chat gpt xd?
ASked to complete the code, but I use this method works in many puzzles
such a good example of imperative vs declarative txt = "nan" txt.split('').reverse().join('') === txt ? 'palindrome' : 'not palidrome'
Обсуждают сегодня