版本号排序
发布日期:2021-11-21 16:35:54 浏览次数:9 分类:技术文章

本文共 343 字,大约阅读时间需要 1 分钟。

arr.sort((a, b) => {    let i = 0    const arr1 = a.split('.')    const arr2 = b.split('.')    while (true) {        const s1 = arr1[i]        const s2 = arr2[i++]        if (s1 === undefined || s2 === undefined) {            return arr2.length - arr1.length        }        if (s1 === s2) continue        return s2 - s1    }})console.log(arr)

 

转载地址:https://blog.csdn.net/yyychocolate/article/details/108264781 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:实现气泡效果的聊天框
下一篇:实现一个搜索框,按钮宽度固定,input的宽度自适应

发表评论

最新留言

关注你微信了!
[***.104.42.241]2024年04月13日 11时21分09秒