Last active
August 12, 2020 14:06
-
-
Save Dodsaren/a346c9f2e745fb3699b58b87895f790b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 isAnagram(w1, w2) { | |
| if (w1.length !== w2.length) { | |
| return false | |
| } | |
| const a1 = Array.from(w1).sort() | |
| const a2 = Array.from(w2).sort() | |
| for (let i = 0; i < a1.length; i++) { | |
| if (a1[i] !== a2[i]) { | |
| return false | |
| } | |
| } | |
| return true | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment