Skip to content
HangoverHangover
首页
项目收藏
留言板
github icon
  • 代码片段

      • 数组合并
        • 最大/最小值
          • Set 对象作用
            • 过滤虚假值
              • 数组洗牌
                • 删除重复元素
                  • 数组比较

                最大/最小值

                author iconHangovercalendar icon2022年4月14日category icon
                • 数组
                tag icon
                • 数组
                • 最小值
                • 最大值
                timer icon小于 1 分钟

                使用 Math.min() 或 Math.max() 结合扩展运算符来查找数组中的最小值或最大值

                const numbers = [6, 8, 1, 3, 9];
                console.log(Math.max(...numbers)); // 9
                console.log(Math.min(...numbers)); // 1
                
                1
                2
                3
                上一页
                数组合并
                下一页
                Set 对象作用
                鸟无声兮山寂寂,夜正长兮风淅淅。 ──李华《吊古战场文》
                Copyright © 2023 Hangover