HashMap Javascript solution Explained
\n//hashmap algorithm\nvar isAnagram = function(s, t) {\n    if (s.length !== t.length) return false;\n    \n    let letters = {};\n    //create hashmap for bot
```\n//hashmap algorithm\nvar isAnagram = function(s, t) {\n    if (s.length !== t.length) return false;\n    \n    let letters = {};\n    //create hashmap for both words, based on a counter\n    for (let i = 0; i < s.length; i++) {\n         letters[s[i]] = letters[s[i]] ? letters[s[i]] + 1 : 1;\n         letters[t[i]] = letters[t[i]] ? letters[t[i]] - 1 : -1;\n    }\n    \n    for (let letter in letters) {\n        //this check for duplicates since if all letters are the same, we will end up with 0\n        if (letters[letter] !== 0) {\n            return false;\n        }\n    }\n    return true;\n};\n```
['JavaScript']