psychopy.org | Reference | Downloads | Github

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!