<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
var num=prompt("q请输入一个五位数")
console.log("输入数据的类型"+typeof num)
var len=num.length-1
console.log("输入字符串的下标最大值"+len)
var flag=true
console.log(flag)
for (var i=0;i<=len;i++){
console.log("num.charAt (i):"+num.charAt (i))
console.log("num.charAt (len-i):"+num.charAt (len-i))
if (num.charAt (i)!=num.charAt(len-i)){
flag=false
console.log(flag)
break
}
}
console.log(num)
alert("判断是否为回文数:"+flag)
</script>
</body>
</html>