Problem in converting js code

URL of experiment: https://pavlovia.org/jaycbcs1/esst_

Description of the problem: not converting code into js

Hello All,

I am designing an experiment which need to add element in array for that
I am using .append function.

based on suggestion from forum i change in to .push in my psychopy code component, and it converted it into .append and showing error it " stimXO1.append is not a function" …

based on new suggestion form

it is saying use .append and it will change into .push but this is also not working.

Do i have to change code in repositery or in psychopy code component or do i have to do some setting change in psychopy to run this error free.

Thank you very much in advance!

Have you put the append = push code in code_JS in the first routine?

If so then you can use append as normal in other code components

thanks for your response.

added

append = push

and also tried

append() = push()

not it is giving error

push is not defined.

Thank You

Sorry. You do need to look at my crib sheet to understand what to type.

Thanks for prompt reply.

i am facing a new problem now…

i have an array like this
eFace = [“anger1f.jpg”, “anger2f.jpg”]

i am accessing this information as

stop1.setImage(eFace[emoId1[trialN]])

but is showing error message

TypeError: cannot read property ‘toString’ of null

any suggetsion for this…

Thanks in advance

What is trialN? I’d recommend logging values to the console to see which bit is failing.

Thank you for replying…

This code was working properly in offline

trilaN is a integer type variable
trialN = 0
emoId1 = [] is array

when i run offline it gives output “anger1f.jpg”

Thank You

Hi!!

Is there any other information is required to resolve this problem, please let me know.

I made small change. it is not giving error now but not working properly.

stop1.setImage(eFace[int(emoId1[int(trialN)]]))

Thank You