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

111
Vistas
code a function if we had equal points between two teams in quiz app

i make quiz app It displays the winner now if the number of questions expires and counts the points, but I want it in the event of the points being equal to display a message that the points is equal and then go back to answer a new question I had a hard time solving this, can you help me?

  self.showWinner = function () {
  // who has the most points?
  let team_data = {};
  for (let team_name of self.teams)
    team_data[team_name] = 0;
  for (let action of self.actions) {
    
    if (self.rounds[self.current.round].indexOf(action.category) === -1)
      continue;
     
    if (action.correct)
      team_data[action.team] += action.difficulty;
    else
      team_data[action.team] -= action.difficulty;
  }
  let name;
  let points = -99999;
  for (let team_name in team_data) {
    if (team_data[team_name] > points) {
      points = team_data[team_name];
      name = team_name;
    }
  }

  // show screen
  $("#overlay").show();
  $("#overlay > *").hide();
  $("#overlay #winner").show();
  $("#winner .text").text(name + " (" + points + " pt)");

  // reset game
  self.teams = [];
};
 if (self.current.round !== undefined && answered_questions === 4) {
    setTimeout(self.showWinner, 10);
    return;
  }
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