TypeError: Undefined is not an object

Update, when I run the script in Safari, I get a more specific error message:

So I think something is wrong with the variable in my Text component shown below.

I wrote down

$SentBeforePrac_list[BeforePracLoop.thisN]

Is there a way to circumvent putting this code directly in the text component but instead using a custom code? That way Psychopy should automatically translate it to JS…