Hi, I am trying to create an experiment with six different experimental conditions online.
I made a Coding component with JavaScript to pick a random condition:
const conditions = ["1", "2", "3", "4", "5", "6"];
const randomCondition = conditions[Math.floor(Math.random() * conditions.length)];
Then, I thought about creating six routines, one for each conditon. If „randomCondition“ = 1, the first routine should be displayed and the others skipped, if „randomCondition“ = 2, the second routine shout be displayed and the others skipped and so on.
I generated the following CS code for the first condition and inserted it on the Coding component of the first routine:
if (randomCondition = 1) {
continueRoutine=True;
} else {
continueRoutine=False;
}
But when I try running the experiment online, this error appears:
ReferenceError: Can’t find variable: randomCondition
Do you have an idea how to fix it or how to code that depending on the condition specific routines should be displayed and others skipped?
Thank you very much
Sina