Update isAnagram.md

This commit is contained in:
Angelos Chalaris
2020-01-22 10:49:16 +02:00
committed by GitHub
parent 7d50df0326
commit 4e37135d2c

View File

@ -5,7 +5,7 @@ tags: string,regexp,intermediate
Checks if a string is an anagram of another string (case-insensitive, ignores spaces, punctuation and special characters).
Use `String.toLowerCase()`, `String.prototype.replace()` with an appropriate regular expression to remove unnecessary characters, `String.prototype.split('')`, `Array.prototype.sort()` and `Array.prototype.join('')` on both strings to normalize them, then check if their normalized forms are equal.
Use `String.prototype.toLowerCase()`, `String.prototype.replace()` with an appropriate regular expression to remove unnecessary characters, `String.prototype.split('')`, `Array.prototype.sort()` and `Array.prototype.join('')` on both strings to normalize them, then check if their normalized forms are equal.
```js
const isAnagram = (str1, str2) => {
@ -22,4 +22,4 @@ const isAnagram = (str1, str2) => {
```js
isAnagram('iceman', 'cinema'); // true
```
```