URL of experiment:
https://run.pavlovia.org/jonas.tvedt/cueing/?__pilotToken=c20ad4d76fe97759aa27a0c99bff6710&__oauthToken=a72848ae19ac2a14c3ddc63d93b5490500697d9647b91ac1df508a41d649c62a
Description of the problem:
Class constructor for creating objects with different stimuli attributes does not work online.
I am trying to create objects of my stimuli that consist of different attributes: the path/name, gender, and rating. The error arises when I try to append the object to a list.
Here is my JS code. First I define my class like this:
class stim {
constructor(img, gender, rating) {
this.img = img;
this.gender = gender;
this.rating = rating;
}
}
img = "";
gender = 0;
rating = [];
rated_stimlist = [];
…then I create the attributes:
img = stimlist.pop()
if img.startswith('images/F'):
gender = 0
if img.startswith('images/M'):
gender = 1
rating = resp_rating.keys
…then I try to append to a list of objects like this:
rated_stimlist.push(stim(img, gender, rating));
…but for some reason, when I run it online ‘stim’ is not recognized and I get the error:
ReferenceError: stim is not defined
Can someone please help me solve this or suggest an alternative method that gives me an equal list of objects?