Skip to content

Instantly share code, notes, and snippets.

@esase
Created April 7, 2022 05:41
Show Gist options
  • Save esase/31d2d3038118fcd74edc509408dac895 to your computer and use it in GitHub Desktop.
Save esase/31d2d3038118fcd74edc509408dac895 to your computer and use it in GitHub Desktop.
/**
* @param {string} s
* @return {boolean}
*/
var isPalindrome = function(s) {
s = s.replace(/[^a-z0-9/s]/gi, '').toLowerCase();
return s.split('').reverse().join('') === s;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment