<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
</head>
<body>
<script type="text/javascript">
const _shouldUpdate = (oldVersion, newVersion) => {
// 补全代码
let newArr = newVersion.split(".")
let oldArr = oldVersion.split(".")
let flag = false
for(let i=0;i<newArr.length;i++){
document.body.innerText+=(Number(newArr[i])>Number(oldArr[i]))
if(Number(newArr[i])>Number(oldArr[i])){
flag = true
}
}
return flag
}
_shouldUpdate('9.0.1','9.1.0');
</script>
</body>
</html>
<html>
<head>
<meta charset=utf-8>
</head>
<body>
<script type="text/javascript">
const _shouldUpdate = (oldVersion, newVersion) => {
// 补全代码
let newArr = newVersion.split(".")
let oldArr = oldVersion.split(".")
let flag = false
for(let i=0;i<newArr.length;i++){
document.body.innerText+=(Number(newArr[i])>Number(oldArr[i]))
if(Number(newArr[i])>Number(oldArr[i])){
flag = true
}
}
return flag
}
_shouldUpdate('9.0.1','9.1.0');
</script>
</body>
</html>