Ho provato quella soluzione ma mi legge il file.txt come una stringa di testo e non come un Array; ho separato la stringa ma rimane sempre un array di stringhe e non un array di numeri come serve allo script che vorrei fare.
codice:
const xhttp = new XMLHttpRequest();
xhttp.open("GET", "visti.txt");
xhttp.send();
xhttp.onload = function() {file = this.responseText;
const blocco = file.split(",");
document.getElementById("demo").innerHTML = blocco[1]+blocco[2]}