Skip to content
Discussion options

You must be logged in to vote

Hi @lhunim95,

The line where you are filtering the data isn't quite right. Unfortunately you can't filter on the name property of the question, because that data is nested inside the response property. filter() also only works at the whole-trial level, so you can't filter to just one of the questions.

Try this instead:

var last_trial_data = jsPsych.data.get().last(1).values()[0].response.question3;
if(last_trial_data == 1) {
 ...

This uses the last() function to get only the previous trial, and then accesses the question3 answer in the response data. Note that this is response and not responses. This was changed in v6.3 for better consistency across plugins.

Replies: 1 comment 1 reply

Comment options

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

Answer selected by lhunim95
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