题解 | 数组最大值

    <script type="text/javascript">
        // 填写JavaScript
        function _max(array) {
   return Math.max(...array);
}
    </script>

Math.max()方法不能接受数组作为参数 使用扩展运算符...展开数组

如:Math.max(...[1,2,3]) 等价于 Math.max(1,2,3)

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务