So drücken Sie nur eindeutige Werte in Array in JavaScript
if(this.items.indexOf(item) === -1) {
this.items.push(item);
console.log(this.items);
}
Nice Narwhal
if(this.items.indexOf(item) === -1) {
this.items.push(item);
console.log(this.items);
}
const arr = Array.from({length: 5}, v => Math.floor(Math.random() * 100));
console.log(arr) // Array with random numbers of length 5