I'm trying to learn jsPsych and tried following along with a video tutorial and I ran into a problem.
The intention was to create a function that adds wether a given response to a stimulus was correct or incorrect to the data that is to be displayed when the paradigm is finished.
In the tutorial this function was written as
on_finish: function(data){
var acc = false;
if (data.correct_response == data.key_press) {
acc = true;
}
data.accuracy = acc;
}
This should add the accuracy variable onto the data and show wether the given response was correct (true) or incorrect (false). Somehow it only returns 'false' for correct and incorrect responses.
In the tutorial they used jsPsych.pluginAPI.convertKeyCodeToKeyCharacter()
This doesn't work tho, I get the error:
lexical_decision.html:46 Uncaught TypeError: jsPsych.pluginAPI.convertKeyCodeToKeyCharacter is not a function
They used this to convert the key code into key characters, but this seemingly happens by default in the current version of jsPsych.
I'm sorry if this question is stupid, but I don't know why this isn't working.