Created
December 21, 2017 02:22
-
-
Save parzibyte/23be1ff57d31406723d6484b51fe82f8 to your computer and use it in GitHub Desktop.
Comprobar si es palíndroma con recursión y JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const esPalindroma = (cadena) =>{ | |
if(cadena.length < 2) return true; | |
if(cadena.charAt(0) === cadena.charAt(cadena.length - 1)) return esPalindroma(cadena.substring(1, cadena.length - 1)); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment