题解 | 判断版本
判断版本
https://www.nowcoder.com/practice/dcc4b011c86c454aa58cb1790a8cb760
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
</head>
<body>
<script type="text/javascript">
const _shouldUpdate = (oldVersion, newVersion) => {
// 补全代码
let oldVersion1 = Number(oldVersion.split('.').join(""))
let newVersion1 = Number(newVersion.split('.').join(""))
return oldVersion1 < newVersion1 ? true : false
}
console.log(_shouldUpdate("1.0.0", "1.0.1"));
</script>
</body>
</html>