Accessing variables within conditional function #859
-
Hello! I am trying to make a simple break in my experiment after the participants complete a certain number of trials. There should be a break whenever
The problem that I'm having is that This might not be a jsPsych specific question, but I'm pretty new to all of this. Thanks so much for the help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
When you're constructing the timeline, all the code is run when you are defining the timeline, not when the participant is running the experiment. If you'd like to display the 'current' information will the participant is running the experiment, you'll want to make the parameter a function https://www.jspsych.org/overview/trial/#dynamic-parameters If you'd like to learn more, these are called closures in Javascript! |
Beta Was this translation helpful? Give feedback.
When you're constructing the timeline, all the code is run when you are defining the timeline, not when the participant is running the experiment. If you'd like to display the 'current' information will the participant is running the experiment, you'll want to make the parameter a function https://www.jspsych.org/overview/trial/#dynamic-parameters
If you'd like to learn more, these are called closures in Javascript!