当前位置:网站首页>How to determine the size of the version number
How to determine the size of the version number
2022-08-11 00:50:00 【piano~~】
How to determine the size of the version number
<script>
function compareVersion(source, target) {
if (typeof source !== 'string' || typeof target !== 'string') return 'The parameter passed in needs to be in the form of a string'
const sourceArr = source.split('.');
const targetArr = target.split('.');
for (let index = 0; index < sourceArr?.length; index++) {
if (sourceArr[index] !== targetArr[index]) {
if (sourceArr[index] > targetArr[index]) {
return 1
}
return -1
}
}
}
const a = compareVersion('1.0.3', '1.0.5');
console.log(a, 'a is');
const b = compareVersion('1.0.7', '1.0.5');
console.log(b)
</script>
边栏推荐
- 【经典排序】快速排序
- 异常:try catch finally throws throw
- 微信小程序内部A页面向内嵌H5页面跳转,并且传参
- [21-day learning challenge - kernel notes] (5) - devmem read and write register debugging
- MySQL索引与事务
- input输入框超出部分用省略号表示以及判断内容是否有超出(PC端)
- C# JObject解析JSON数据
- 91.(cesium之家)cesium火箭发射模拟
- 【.NET Core】使用 NPOI 读写Excel 文件
- [Excel knowledge and skills] Convert numeric format numbers to text format
猜你喜欢

SQL语句--获取数据库表信息,表名、列名、描述注释等

分布式.性能优化

EN 12467纤维水泥平板产品—CE认证

C#使用计时器

微信小程序自定义navigationBar

双机热备综合实验(VRRP+OSPF+VTP+NAT+DHCP+PVSTP+单臂路由)

Use mysql statement to operate data table (table)

Only lazy and hungry. You still don't understand the singleton pattern!

时间戳转换为日期格式、获取当前时间戳

Introduction to Qt (6) - Implementation of the lottery system
随机推荐
力扣------用栈操作构建数组
Why do programming languages have the concept of variable types?
小程序onPageNotFound的坑
C# using timer
word 设置标题前分页
C#-委托的详细用法
容器技术真的是环境管理的救星吗?
C#使用计时器
微信小程序自定义navigationBar
YOLOv5的Tricks | 【Trick11】在线模型训练可视化工具wandb(Weights & Biases)
总结Qt中常用文件信息QFileInfo的获取:后缀,名称,路径,链接
什么是“门”电路(电子硬件)
时间戳转换为日期格式、获取当前时间戳
全排列思路详解
Difference Between Image Recognition and Semantic Segmentation
Web APIs BOM - A Comprehensive Case of Operating Browsers
[21 Days Learning Challenge] Half Insertion Sort
EPro-PnP: Generalized End-to-End Probabilistic Perspective-n-Points for Monocular Object Pose Est...
How to build speed, speed up again
【openpyxl】过滤和排序