Skip to content
Discussion options

You must be logged in to vote

Edit: Fixed earlier error with the result of the concat function not being assigned back to the timeline variable, which resulted in the randomized blocks not being added to the timeline.

Hi @lily2brain, one way to do this is to create an array of just the blocks that you want to randomize, randomize that array using jsPsych.randomization.shuffle, and then concatenate the randomized blocks with your timeline array using the JavaScript array concat function. Here's an example:

// create an empty array to store your experiment's timeline
var timeline = [];

// define the trials/procedures that come before your blocks, and add them to the timeline array
timeline.push(fullscreen);
timeline.push(

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@lily2brain
Comment options

Comment options

You must be logged in to vote
5 replies
@lily2brain
Comment options

@becky-gilbert
Comment options

@lily2brain
Comment options

@becky-gilbert
Comment options

@lily2brain
Comment options

Answer selected by lily2brain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants