NameError: name 'stimulus' is not defined

Hi there. I am an undergraduate student new to psychopy. I’m designing a self-paced reading task, and I’d like to have the participants press the spacebar to bring up a next phrase.

So here is the code I wrote

//Clear the buffer
psychoJS.eventManager.clearEvents()
psychoJS.eventManager.clearKeys()
//Parse our stimulus
words = target.split(" ")
//Create individual word stimuli
sentPos = 0
stimulus = words[sentPos
//Create a clock
clock = new util.clock()

But I’m getting this error

NameError: name ‘stimulus’ is not defined

In the excel file I attached to the loop, there is a variable called target, and then there are 30 sentences below it.

What is wrong with that?
Thanks.

In the code you’ve just pasted, stimulus = words[sentPos is missing a closing bracket.

Thanks for the reply.
By the way, I accidentally removed the ‘]’ while posting, the actual code contains ‘]’.

Did you write raw JS code? I highly recommend writing in Python in an auto component. I notice that your JS code has no semi colons.

Thanks for the reply, but I didn’t have enough time to figure out how to make the code work. So I decided to use a different method, although I ran into problems with that one too :frowning:
Anyway, thank you so much!