| Reference | Downloads | Github

Experiment Unspecified JavaScript error

URL of experiment:

Description of the problem: I’ve seen some others have similar questions with me. My experiment including 4 image stimuli and a sound stimuli. When I try to run the experiment with or without sounds, the message window showed JavaScript error. I had no previous experiences with coding so it would be very helpful if someone could help. Thank you.


Please could you let us know a bit more about your code components and the specific error. You should be able to get it from the console – have a look at my crib sheet for more details.

Best wishes


Thank you for the message, I am not sure what specific error it refers to.

The code for my image stimuli is as follow
trailClock = new util.Clock();
image = new visual.ImageStim({
win : psychoJS.window,
name : ‘image’, units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [(- 0.2), (- 0.2)], size : [0.1, 0.1],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 128, interpolate : true, depth : 0.

Sound stimuli:
mouse.mouseClock = new util.Clock();
sound_1 = new sound.Sound({
win: psychoJS.window,
value: sound,
secs: (- 1),

Thanks again

In my crib sheet I discourage the creation of sound objects in code.

I edited the sound component but another area show major errors

return function () {

//------Loop for each frame of Routine ‘instruction’-------
let continueRoutine = true; // until we’re told otherwise
// get current time
t = instructionClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
// update/draw components on each frame

// *text* updates
if (t >= 0.0 && text.status === PsychoJS.Status.NOT_STARTED) {
  // keep track of start time/frame for later
  text.tStart = t;  // (not accounting for frame time here)
  text.frameNStart = frameN;  // exact frame index

Which are?

My apology. I really have no clue about JavaScript. I will need to research more.

Hello, sorry for getting back to you with a delay. I check my coding with console and got the result as follow.

Based on those reports it looks like text and image 1 to 4 must be set every routine. What is the next component in the flow after image_4 ?

I used loop to select image source from excel file. Is that why the image says undefined?

Correct. A component that updates every loop is set to undefined at the beginning of the experiment. Please could you show a screenshots of your routines within the loop and the loop itself?

Hi I just realize that there is an empty column in my excel master file so it keep disturbing the route. The problem is now solved. Thank you again for helping me since yesterday!

1 Like