数组去重
2021-02-15 04:20
标签:UNC random mat fun 索引 长度 undefined war func 数组去重 标签:UNC random mat fun 索引 长度 undefined war func 原文地址:https://www.cnblogs.com/sheep2/p/12715856.html个人总结
数组去重
let ary = [2, 6, 5, 5, 99, 65, 5, 2, 989, 23, 65, 6 ]
function getDiff(arr) {
let obj = {}
for (let i = 0; i
在20个数中取得不同的5个数
let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
function getNums(arr, count) {
let newArr = []
for (let i = 0; i