Well, JS code errors on Pavlovia

You’ve linked to my code snippets page rather than my crib sheet. However, at the top it says:

Code components should be Auto Py->JS unless code has been added to the PsychoJS column. I would recommend that all experiments intended to run online contain a JavaScript code component in their first routine called code_JS with the following in Begin Experiment.

thisExp=psychoJS.experiment;
win=psychoJS.window;
event=psychoJS.eventManager;
shuffle = util.shuffle;
Array.prototype.append = [].push;

Please do tell me if there’s something in that paragraph that needs further explanation.

When changing from JS back to Auto I would recommend copying the JS code to the clipboard, then agreeing to overwrite it, then pasting it into the Python side and finally formatting it as grammatically correct Python code such that auto translated JS code appears on the JS side.