URL of experiment: Noah Hager / javatranslatetest · GitLab
Description of the problem:
Hey guys, i’ve been trying to get a PsychoPy experiment that i mostly programmed in Python (PsychopyBuilder) to get to work on Pavlovia, so i’ve been trying to translate it to JS (which isn’t my forte at all) but i need to make it work beacuse its for my bachelors thesis hahaha… i’ve been getting stuck on this one error message recently that pops up right at the beginning when trying to run it online, the error message says “TypeError: Cannot use ‘in’ operator to search for ‘backspace’ in undefined”.
Here’s a screenshot of where the error appears, and i copied out the piece of code:
// Run ‘Each Frame’ code from code_4
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;
}
It seems to be a problem where “right” isn’t defined previous to this code snippet, but i can’t for the life of me figure out where this should have happened…
any help or info on this would be greatly appreciated because i’ve been stuck on this for a while now…
I linked my GitLab at the top where all the resources and code are uploaded if people want to look at it!
Thanks for any help!
CHeers, Noah