10.8.1.2. La fonction ispalindrome
/*Using our reverse function for strings, we can create our palindrome
checker. Recall that our approach will be to take the string argument,
reverse it, and then compare the reversed string to the original
string.*/
function reverse(str) {
return str.split('').reverse().join('');
}
function isPalindrome(str) {
return reverse(str) === str;
}
Tough Tortoise