Problem 1. Applications of dictionaries a) Check if two strings are anagrams. Two strings s1 and s2 are called anagrams if s2 can be formed by rearranging the characters of s1 code example
Example: check if anagram
function isAnagram(stringA, stringB) {
stringA = stringA.toLowerCase().replace(/[\W_]+/g, "");
stringB = stringB.toLowerCase().replace(/[\W_]+/g, "");
const stringASorted = stringA.split("").sort().join("");
const stringBSorted = stringB.split("").sort().join("");
return stringASorted === stringBSorted;
}