Update isAnagram.md
This commit is contained in:
@ -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
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user