anagram javascript example
function anagram(name, words) {
var a = name.replace(/\s/g,'').toLowerCase().split('').sort().join('');
var b = words.join('').split('').sort().join('');
return a == b;
}
anagram javascript example
function anagram(name, words) {
var a = name.replace(/\s/g,'').toLowerCase().split('').sort().join('');
var b = words.join('').split('').sort().join('');
return a == b;
}
anagram js
function isAnagram(stringA, stringB) {
// Sanitizing
stringA = stringA.toLowerCase().replace(/[\W_]+/g, "");
stringB = stringB.toLowerCase().replace(/[\W_]+/g, "");
// sorting
const stringASorted = stringA.split("").sort().join("");
const stringBSorted = stringB.split("").sort().join("");
return stringASorted === stringBSorted;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us