I'm working on a project and would like to know if there's an easy way to define and use multiple variables without having to write a bunch of code.
So what I've been doing is just defining them all like this:
var Kahoot = require("kahoot.js-updated");
var client1 = new Kahoot;
var client2 = new Kahoot;
var client3 = new Kahoot;
var name = "example";
var id = "12345";
And then using them like this:
client1.join(id , name+"1").then(() => {client1.on("question", question => {});client1.on("questionStart", question => {question.answer(randomAnswer());})});
client2.join(id , name+"2").then(() => {client2.on("question", question => {});client2.on("questionStart", question => {question.answer(randomAnswer());})});
client3.join(id , name+"3").then(() => {client3.on("question", question => {});client3.on("questionStart", question => {question.answer(randomAnswer());})});
This works well, but I have to manually copy and paste, then replace the variable number. What is an easier way to do this without copypasting over and over?