Hi @tjl, the method is slightly different, and requires your to sum the contents yourself because there are no built-in methods for summing as there are with Python.
// Get all correct
nCorr = 0
for (eachResp=0; eachResp<psychoJS.experiment._trialsData.length; eachResp++)
{
nCorr += psychoJS.experiment._trialsData[eachResp]['key_resp.corr'];
}
msg = "You got " + nCorr + " trials correct";
/**
To get the mean, sum the actual RTs as you do with the accuracy, then divide the RTs by the length of the `_trialsData` list use the length method e.g., `psychoJS.experiment._trialsData.length`.
*/
For a one-liner sum and mean method:
responses = psychoJS.experiment._trialsData // get list of responses
nCorr = responses.reduce((a, b) => a + b['key_resp.corr'], 0) // get sum
meanRT = responses.reduce((a, b) => a + b['key_resp.rt'], 0) / responses.length // get mean