I'm trying to build my own Discord bot and I want it to send some random things from an array i already have, but don't want them to be the same (should be different every time). For example, I have 5 things in my array and I want to reply with 3 different elements from the array.
This is my code at the moment:
var question = ["answer1", "answer2", "answer3", "answer4", "answer5"];
var temparray = [];
for(i=0;i<3;i++){
for(j=0;j<domande.length;j++){
temparray[i] = domande[Math.floor(Math.random() * domande.length)];
temparray[j] = temparray[i];
if(!temparray[i] === temparray[j]){
}
}
console.log(temparray[i]);
}
Are 2 for way to much, or am I missing something there?