Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

117
Vistas
Safari only showing one option in select element

I'm creating a web site to add statistics from multiple games. The first part reads json files which contain the stats (multiple files per game) and populates an HTML select element for the user to select which games to include in the stats (allowing user to select multiple games). It's working in Chrome and Edge on my computers, but in Safari (iPhone) only one of the games shows as an option (the 4th of 5 games). Below is the function to read the files. Why would this not be working in Safari? I'm not sure if it has to do with the await / async or something else.

jsonFiles = ['file1.json', 'file2.json', 'file3.json'];

async function readGames() {
    let games = {};
    for (let file of jsonFiles) {
        let playlist;
        let gameDate;
        let response = await fetch(file);
        let data = await response.json();
        playlist = data.playlist;
        gameDate = (new Date(playlist.slice(playlist.indexOf('(')+1, playlist.indexOf(')'))).getTime())/10000;
        if (!(gameDate in games)) games[gameDate] = playlist;
    }
    //Remove previous options in the select element
    while(gamesSelect.firstChild) {
        gamesSelect.removeChild(gamesSelect.firstChild);
    }
    const gameValues = Object.values(games);
    for (let game of gameValues) {
        let option = document.createElement('option');
        option.setAttribute("value", game);
        option.innerHTML = game;
        gamesSelect.append(option);
    }
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda