class HighScoreLoader{ constructor(){ this.table = document.getElementById("highscoreTable"); this.data = undefined; this.setup(); } async setup(){ const response = await fetch("/api/highscore"); this.data = await response.json(); for(const score of this.data.scores){ this.table.innerHTML += ` ${score.rang} ${score.user1.username} ${score.user2.username} ${score.score} ` } } } new HighScoreLoader();