Unspecified JavaScript error message

I keep getting an unspecified javascript error message

link: https://run.pavlovia.org/smoha005/cirso/html/

First code for randomisation is:

    for (var i = start; i < end; i++) {
        foo.push(i);
    }
    return foo;
}

function shuffle(array) {
  for (let i = array.length - 1; i > 0; i--) {
    let j = Math.floor(Math.random() * (i + 1)); 
    [array[i], array[j]] = [array[j], array[i]];
  }
}

var trialListCatA = range(2,6);
var trialListCatB = range(6,8);
var trialListCatC = range(8,20);
var trialListCatD = range(20,26);
var trialListCatE = range(26,38);
var trialListCatF = range(38,42);
var trialListCatG = range(42,68);

shuffle(trialListCatA);
var catAsliceBL2 = trialListCatA.slice(0,3);
var catAsliceBL3 = trialListCatA.slice(3,4);

shuffle(trialListCatG);
var catGsliceBL2 = trialListCatG.slice(0,15);
var catGsliceBL3 = trialListCatG.slice(15,26);

trialListBlock1 = trialListCatA.concat(trialListCatB);
trialListBlock2 = trialListCatC.concat(trialListCatD, catGsliceBL2, catAsliceBL2);
trialListBlock3 = trialListCatE.concat(trialListCatD, trialListCatB, trialListCatF, catGsliceBL3, catAsliceBL3);
trialListBlock4 = trialListCatA.concat(trialListCatB);```

The other JS code is 
```// Begin Routine
function getRandomIntInclusive(min, max) {
  min = Math.ceil(min);
  max = Math.floor(max);
  return Math.floor(Math.random() * (max - min + 1)) + min; //The maximum is inclusive and the minimum is inclusive 
}

jitter = getRandomIntInclusive(100, 500)  // Gives random value between 100 and 500, inclusive
// This value can be passed to your blank component for providing
// a random gap between sound and stimulus```

Both JS codes are syntactically valid so I am not sure where the problem lies

@Michael I keep getting an unspecified javascript error message in the middle of some trials when completing the study (link below) I don’t know what the problem is. Could you please help me sort this issue out

https://run.pavlovia.org/smoha005/jenin/html

Sorry, but Javascript isn’t really my forté. Hopefully someone else can chip in here.

Hi @jon @dvbridges
Could you please help me figure out how to sort this issue out.

the randomisation code has been put before the loop and is suppose to randomise the stimuli within blocks however, I keep getting a ‘unspecified javascript error’

I believe the sound is the issue here as I have uploaded the experiment without the sound trigger and works fine - no error messages. Does anyone know how to overcome this issue and why the sound is a problem here?

Link without sound:
https://run.pavlovia.org/smoha005/without_sound/html/

Hi @smoha005, I got the same error and I guess this is due to sound. Have you solved the problem?

Hi @Xiaotong, I basically had to upload my own sound as a (wav file) which worked. Using the sound A etc from the actual software does not work so I suggest uploading your own sounds as a wav or mp3 file which should work.

Big thanks! Problem solved!

Hi @smoha005, I’m having a similar problem when piloting my experiment. My sound files don’t play and I get the same error message.
I think your solution might work for me as well, but I don’t understand what exactly you did? Where did you upload your wav files?
Thanks so much!

1 Like

Hello,
I’m dealing with the same problem. Like yourself, I didn’t quite understand what should I do. Did you solve the problem?

Thanks!
Hadeel

I have a couple of suggestions in my crib sheet. Most recently I got one because of a decimal text size when using pixel units

I will check it Thanks!

Hello,
together with a colleague, I figured out that if we change the sound properties in the builder to “set every repeat” instead of " set during: ISI", the Javascript error does not occur any more.
I don’t know why as I don’t really know Javascript and mainly used the builder for the experiment, but maybe this is helpful for you as well!

I do know that there’s a problem with ISIs in the online experiments…as in they don’t seem to work. I therefore am not surprised that setting something during an ISI would cause an error.

I’ve abandoned the ISI component for online use.