Play this article
One string is an Anagram of another if it uses the same characters in the same quantity. ignore spaces, punctuations While validating both strings for Anagram Problem.
Ex-
isAnagram(‘rail safety.’, ‘fairy tales’) →true
isAnagram*(‘Rail SafeTy’, ‘fairy tales.’) **→true*
Let’s Solve -
Step0 → create a function, take both strings as args
Step1 → remove spaces/punctuations from both the strings
step 3 → now to validate both strings,
str1.split(“”).sort().join(“”)===str2.split(“”).sort().join(“”)