Created
April 3, 2018 15:16
-
-
Save parzibyte/4c01975bc4d39de2c067ae8b5d711aa3 to your computer and use it in GitHub Desktop.
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
function esAnagrama(palabra, posibleAnagrama){ | |
//Si desde un principio son iguales, regresamos false; ya que no tienen orden distinto | |
if(palabra.toLowerCase() === posibleAnagrama.toLowerCase()) return false; | |
return palabra.toLowerCase().split("").sort().join("") === posibleAnagrama.toLowerCase().split("").sort().join(""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment