Skip to content

Commit fea3192

Browse files
committed
valid-palindrome solution
1 parent 18f4003 commit fea3192

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

valid-palindrome/yuhyeon99.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @param {string} s
3+
* @return {boolean}
4+
*/
5+
var isPalindrome = function(s) {
6+
const regexp = /[^a-z0-9]/g;
7+
s = s.toLowerCase();
8+
s = s.replaceAll(regexp, "");
9+
10+
return s === [...s].reverse().join('');
11+
};

0 commit comments

Comments
 (0)