Files
30-seconds-of-code/test/isAnagram/isAnagram.js
2018-02-19 15:47:47 +02:00

5 lines
206 B
JavaScript

const isAnagram = (str1, str2) => {
const normalize = str => str.toLowerCase().replace(/[^a-z0-9]/gi, '').split('').sort().join('');
return normalize(str1) === normalize(str2);
}
module.exports = isAnagram;