Skip to content

Commit 4372660

Browse files
committed
if it doesn't have the same length cut it short
1 parent acc3adc commit 4372660

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/anagram-service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class AnagramService {
4848

4949
const filteredWordsMapKeys = this.wordsArray.filter((word) => {
5050
const hasSameLength = word.length === term.length;
51-
51+
if (!hasSameLength) return false;
5252
const wordCharacterMap = this.getCharacterMap(word);
5353
const MapsAreEqual = lodash.isEqual(wordCharacterMap, termCharacterMap);
5454

0 commit comments

Comments
 (0)