Skip to content
Discussion options

You must be logged in to vote

One way to do this would be to turn the choices parameter into a function that can compute where the target should be placed.

choices: function(){
	// make an array with the foils
	var foils = [
		jsPsych.timelineVariable('Foil1', true),
		jsPsych.timelineVariable('Foil2', true),
		jsPsych.timelineVariable('Foil3', true)
	];
	// shuffle the order of the foils
	var foils_in_random_order = jsPsych.randomization.shuffle(foils);
	// add target in proper location
	foils_in_random_order.splice(jsPsych.timelineVariable('button', true), 0, jsPsych.timelineVariable('Target', true));
	// return back the full array
	return foils_in_random_order;
}

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
2 replies
@FelicityF
Comment options

@jodeleeuw
Comment options

Answer selected by FelicityF
Comment options

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

@FelicityF
Comment options

@FelicityF
Comment options

@becky-gilbert
Comment options

@FelicityF
Comment options

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