JSFiddle - React, Tailwind, and code Playground
JavaScript
var arr = ["1","2","3","4","5","6","7","8","9","10"]
var temp=[];
while(temp.length<3){
rand = Math.floor((Math.random() * arr.length));
if(temp.indexOf(arr[rand])<0){
temp.push(arr[rand])
}
}
console.log(temp);