-
Notifications
You must be signed in to change notification settings - Fork 0
/
kata.js
26 lines (17 loc) · 845 Bytes
/
kata.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var isAnagram = function (test, original) {
let testLet = test.toLowerCase().split('').sort().join('');
let origLet = original.toLowerCase().split('').sort().join('');
return testLet === origLet;
};
console.log(isAnagram("foefet", "toffee")); // true
// 'The word "foefet" is an anagram of "toffee"'
console.log(isAnagram("Buckethead", "DeathCubeK")); // true
// 'The word "Buckethead" is an anagram of "DeathCubeK"'
console.log(isAnagram("Twoo", "WooT")); // true
// 'The word "Twoo" is an anagram of "WooT"'
console.log(isAnagram("dumble", "bumble")); // false
// 'Characters do not match for test case "dumble", "bumble"'
console.log(isAnagram("ound", "round")); // false
// 'Missing characters for test case "ound", "round"'
console.log(isAnagram("apple", "pale")); // false
// 'Same letters, but different count'