比sort()性能更好的原生js代码实现数组从小到大排序
2021-06-16 13:05
                         标签:实现   style   xid   --   color   pre   bsp   ==   排序      比sort()性能更好的原生js代码实现数组从小到大排序 标签:实现   style   xid   --   color   pre   bsp   ==   排序    原文地址:https://www.cnblogs.com/hrlin/p/9726271.html    nums = [1,2,4,1,34,6,-1,2]
    for(let i = nums.length - 1; i > 0; i--) {
        let maxIdx = i;
        for(let j = 0; j ) {
            if(nums[maxIdx]  j;
        }
        if(maxIdx !== i) {
            let temp = nums[maxIdx];
            nums[maxIdx] = nums[i];
            nums[i] = temp;
        }
    }
文章标题:比sort()性能更好的原生js代码实现数组从小到大排序
文章链接:http://soscw.com/index.php/essay/94582.html