I am a bit new in JavaScript, trying to do the hardcoded part above in a more scalable way with the function below. The 't' + i
functions well but do the same with the .t + i
function showInfo(results) {
var data = results.data
document.getElementById('t1').innerHTML = [data[0].t1].join(', ')
document.getElementById('t2').innerHTML = [data[0].t2].join(', ')
document.getElementById('t3').innerHTML = [data[0].t3].join(', ')
document.getElementById('t4').innerHTML = [data[0].t4].join(', ')
}
function showInfo(results) {
var data = results.data
for (let i = 1; i < data.length; i++) {
document.getElementById('t' + i).innerHTML = [data[0].t + i].join(', ')
}
}