125、验证回文串
作者:互联网
var isPalindrome = function(s) {
const str=s.toLowerCase().replace(/[\W_]/g,"");
if(str.length<2){
return true;
}
let left=0;
let right=str.length-1;
while(left<right){
if(str[left]!==str[right]){
return false;}
left++;
right--;
}
return true;
};
标签:right,return,验证,length,let,125,str,回文,left 来源: https://blog.csdn.net/m0_51603531/article/details/122598545