Hello,
I’m using this JS code for feedback after a loop. The experiment is running in pilot mode and there are no error messages, and the message that appears is Hello World. So, that’s my question…what is wrong with my code that the message on the screen appears as Hello World?
// Get all correct
var msg;
var nCorr;
nCorr = 0;
for (let eachResp=0; eachResp<psychoJS.experiment._trialsData.length; eachResp++)
{
if (‘key_resp_2.corr’ in psychoJS.experiment._trialsData[eachResp]) {
nCorr += psychoJS.experiment._trialsData[eachResp][‘key_resp_2.corr’];
}
}
{
msg = “You got " + nCorr + " trials correct”;
}