当前位置:网站首页>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>
边栏推荐
- Where can I download IEEE papers?
- 【21天学习挑战赛】折半插入排序
- [GXYCTF2019]BabySQli
- Dump file generation, content, and analysis
- [Excel knowledge and skills] Convert "false" date to "true" date format
- 容器技术真的是环境管理的救星吗?
- YOLOv5的Tricks | 【Trick13】YOLOv5的detect.py脚本的解析与简化
- Analysis of LENS CRA and SENSOR CRA Matching Problems
- SAP ABAP JSON 格式数据处理
- 【openpyxl】过滤和排序
猜你喜欢

【爬虫】scrapy创建运行爬虫、解析页面(嵌套url)、自定义中间件(设置UserAgent和代理IP)、自定义管道(保存到mysql)

leetcode 前K个高频单词

How to easily obtain the citation format of references?

MySQL索引与事务

How to check if the online query suddenly slows down

Jvm.分析工具(jconsole,jvisualvm,arthas,jprofiler,mat)

【.NET Core】使用 NPOI 读写Excel 文件
![[Excel knowledge and skills] Convert](/img/96/ece9c3885fd4abe4bf4d211813b9c4.png)
[Excel knowledge and skills] Convert "false" date to "true" date format

postgresql参数意义

How engineers treat open source
随机推荐
How to do patent mining, the key is to find patent points, in fact, it is not too difficult
如何做到构建的提速,再提速
22/8/9 贪心问题合集
异常:try catch finally throws throw
循环单词
容器技术真的是环境管理的救星吗?
22/8/9 Collection of Greedy Problems
Mysql. Slow Sql
Lens filter---about day and night dual-pass filter
Web APIs BOM - A Comprehensive Case of Operating Browsers
微信小程序强制更新版本
Exceptions and exception handling mechanisms
@Autowired注入RedisCache报错空指针
[GXYCTF2019]BabySQli
Difference Between Image Recognition and Semantic Segmentation
input输入框超出部分用省略号表示以及判断内容是否有超出(PC端)
云原生-FRP内网穿透(详解)使用云服务器将内网集群服务暴露至公网(二)
WebView2 通过 PuppeteerSharp 实现RPA获取壁纸 (案例版)
虚拟电厂可视化大屏,深挖痛点精准减碳
sed of the Three Musketeers of Shell Programming