Created
April 2, 2020 13:35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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