An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.[1] For example, the word anagram can be rearranged into nag a ram, or the word binary into brainy or the word adobe into abode.
npm install allalgorithms
const allalgorithms = require('allalgorithms');
const strA = 'RAIL? SAFETY';
const strB = 'fairy tales';
console.log(allalgorithms.strings.anagrams(strA, strB));
// -> true
Returns true if strings are anagrams
strA
: First stringstrB
: Second string