用JS判断字符串是否回文
var str = "121";
var length = str.length;
var flag = true;
for(var i = 0,j= length-1; i<length/2;i++,j--){
if(str[i] == str[j]){
continue;
}
else{
flag = false;
break;
}
}
if(flag){
console.log(str+'is huiwen');
}
else{
console.log(str+'is not huiwen');
}