题解 | #新数组#

新数组

https://www.nowcoder.com/practice/bee781a51bc944bbad20f3c2ca798890

<!DOCTYPE html>
<html>
    <head>
        <meta charset=utf-8>
    </head>
    <body>
        
        <script type="text/javascript">
            const _delete = (array,index) => {
                // slice(start, end);包含start,不包含end
                // 返回的是删除元素,而不是被删除之后的元素
                // return array.slice(index, index + 1);
                // 正解
                return array.filter((itme,i) => i !== index);
            }
        </script>
    </body>
</html>
全部评论

相关推荐

头像
不愿透露姓名的神秘牛友
04-08 00:50
点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务