题解 | #无重复数组#
无重复数组
https://www.nowcoder.com/practice/d2fa3632268b41df9bc417b74802ad8c
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<script>
const _getUniqueNums = (start,end,n) => {
// 补全代码
let arr = [];
for(let i = 0; i < n; i++) {
let num = Math.floor(Math.random()*end)+start;
if (!arr.includes(num)) {
arr.push(num)
}
}
return arr;
}
</script>
</body>
</html>
