// Current socket.emit("QuizQuestion", {quizinstance: quizinstance, question: {"text":"Wurde der Server gehackt?","options":["Kekse für alle!","ich weiß nicht","ach quatsch","vielleicht"],"type":"0"}}) //Current copy var falschArray = ["kalt", "kälter", "ganz kalt", "eiszeit"]; var qobj = qr.question; for(let i = 0; i < qobj.options.length; i++){ if(i == 0) continue; var randomValue = falschArray[Math.floor(Math.random() * falschArray.length)]; qobj.options[i] = randomValue; } socket.emit("QuizQuestion", {quizinstance: quizinstance, question: qobj}); // All socket.emit("QuizQuestion", {recipient: "clients", quizinstance: "something", question: {"text":"Wurde der Server gehackt?","options":["Kekse für alle!","ich weiß nicht","ach quatsch","vielleicht"],"type":"0"}})