给出以下代码:
random: function() {
return Math.floor(Math.random() * 100 + 1)
}
let result = []
result.push(random()) // it doesn't matter if this integer is pushed again in the next line
[...Array(10)].forEach((_, i) => result.push(random())) // all of these have to be unique
如何确保没有重复项被推入result
(可能是第一个),而却将数组的长度保持在11?