Hi, I'm a Psychology student and newbie to javascript. I am trying to create a behavioural task on qualtrics using javascript.
The game works and I am able to provide the participant with feedback at the end of each round (there are 10 atm). What I would like to know is whether there is a way for the following six sentences to be presented one at a time in a consecutive order?
I can get the task to present one of the six at random, however, when I remove Math.random from the code, all six sentences are displayed as one chunk.
var feedback_array1= [
"<p>Congratulations you won the game. </ p> <p>The other player picked A</p>",
"<p>Congratulations you won the game. </ p> <p>The other player picked B</p>",
"<p>Congratulations you won the game. </ p> <p>The other player picked C</p>",
"<p>You lost! </p><p>The other player picked A</p>",
"<p>You lost! </p><p>The other player picked B</p>",
"<p>You lost! </p><p>The other player picked C</p>", ];
var msg_feedback1 = function(){
return feedback_array1 [Math.floor(Math.random()*feedback_array1.length)] ;
};
An alternative method would be to save the order of the randomized feedback, through I have had much luck devising that either!
Any help would be greatly appreciated. Many thanks in advance!