Skip to content

Instantly share code, notes, and snippets.

@muditlambda
Created April 2, 2020 13:35
const checkPalindrome = (string) => string == string.split('').reverse().join('');
// function to check anagram //
const checkAnagram = (w1, w2) => {
const regularize = (word) => {
return word.toLowerCase().split('').sort().join('').trim();
}
return regularize(w1) === regularize(w2);
}
module.exports = {checkPalindrome, checkAnagram};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment