문제 링크 : Valid Palindrome
/**
* @param {string} s
* @return {boolean}
*/
var isPalindrome = function(s) {
let newStr = s.replace(/[^a-z0-9]/gi,"").toLowerCase();
return newStr.split("").reverse().join("") === newStr ? true : false;
};
/**
* @param {string} s
* @return {boolean}
*/
var isPalindrome = function(s) {
let string = s.replace(/([^\w]|_)/g,'').toLowerCase();
let left = 0, right = string.length - 1;
while(left < right){
if(string[left] !== string[right]){
return false;
}
left++; right--;
}
return true;
};