I'm trying to load 3 characters from 5 difference websites and a concatenate them into one string, even though I'm using a try & catch statement the strings say'uncaught reference error' and any codes with numbers cause a 'unexpected tokens error'. I'm using the P5.js framework at the moment but willing to try plain .js.
Thanks
My code:
var data;
function setup(){
var url = [];
url[0] = 'https://assess.joincyberdiscovery.com/challenge-files/clock-pt1?verify=NRpxYLm9hCkAkhy0OSjEPA%3D%3D.json'
url[1] = 'https://assess.joincyberdiscovery.com/challenge-files/clock-pt2?verify=NRpxYLm9hCkAkhy0OSjEPA%3D%3D.json'
url[2] = 'https://assess.joincyberdiscovery.com/challenge-files/clock-pt3?verify=NRpxYLm9hCkAkhy0OSjEPA%3D%3D.json'
url[3] = 'https://assess.joincyberdiscovery.com/challenge-files/clock-pt4?verify=NRpxYLm9hCkAkhy0OSjEPA%3D%3D.json'
url[4] = 'https://assess.joincyberdiscovery.com/challenge-files/clock-pt5?verify=NRpxYLm9hCkAkhy0OSjEPA%3D%3D.json'
try{
for (let i = 0; i < 5; i++){
data += loadJSON(url[i], gotData, 'jsonp') + ' '
}
} catch (data){
console.log('oh well');
}
}
function draw(){
createCanvas(400,400);
background(225);
text(data, 0, 200);
}
function gotData(data){
text(data, 100, 200);
}