Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 3, 2018 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/4c01975bc4d39de2c067ae8b5d711aa3 to your computer and use it in GitHub Desktop.
Save parzibyte/4c01975bc4d39de2c067ae8b5d711aa3 to your computer and use it in GitHub Desktop.
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