Thanks for the reply. I kinda of get this solution conceptually. Basically there’s an issue with the enumerate function translating to JS. Does this mean I would have to rewrite the entire code block in JS to make it work?
@calebo55 there are a number of Python code bits that won’t translate super well to JS. You can use the “both” option instead of Auto->JS and edit the line of JS code independently. Just make sure it saves correctly and that it doesn’t get overwritten when you open that window later.
If you’ve ever used Google translate you’ll know that when it doesn’t work it’s a good idea to change your source language (for example to remove complex words or idioms) to give the translation tool an easier task. That’s my approach to the PsychoPy auto translate.
Ok. So I set it to Code Type = “Both” and edited my code to java script as I understand it (which is next to nothing). This is the code I changed the python to, but it still displays a syntax error. I guess I’m kind of confused about how to edit python and JS in the same window.
function clickCount(clicked, box){
#Return the list indices of a box
for [i, x] of clicked.entries() {
if (x == box){
return i+1
}
}
}