Hi All,
My team and I have created an experiment which has lots of code components in it, all of which has auto translated into JS OK. However, when we try and run it online we get the error Uncaught SyntaxError: Unexpected token ‘var’ which I believe is due to an auto translation error in psychopy for a few of our text components (possibly something to do with the code we’ve written). In the JS script the code is:
// *GRDinvesttotal* updates
if ((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);
_pj.in_es6(mode, ["investing", "closing_time"])) && GRDinvesttotal.status === PsychoJS.Status.NOT_STARTED)
The problem is coming from this if statement if (( var _pj;
but I’m unsure as to what it is doing. I could manually remove the var but would have to do this every time I make a change. Any suggestions on how to fix this issue?
Thanks in advance for any responses