Hi,
I have a loop with 200 trials. The loop is called trials_1. I want to present a notification every 50 trials. So I include a code component:
Blockquote
Each frame
if not trials_1.thisN in [50]: # on most trials:
continueRoutine = False # don’t even start this routine
else:
print(trials_1.thisN)
I translate this code to run the experiment online:
var _pj;
function _pj_snippets(container) {
function in_es6(left, right) {
if (((right instanceof Array) || ((typeof right) === “string”))) {
return (right.indexOf(left) > (- 1));
} else {
if (((right instanceof Map) || (right instanceof Set) || (right instanceof WeakMap) || (right instanceof WeakSet))) {
return right.has(left);
} else {
return (left in right);
}
}
}
container[“in_es6”] = in_es6;
return container;
}
_pj = {};
_pj_snippets(_pj);
if ((! _pj.in_es6(trials_1.thisN, [61]))) {
continueRoutine = false;
} else {
console.log(trials_1.thisN);
}
But it is not working: the message does not appear. At the same time, there is no error message. I have another loop, called “trials” (instead of “trials_1”), and my code works with this loop perfectly and online as well.