Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

176
Views
codificar una función si tuviéramos puntos iguales en la aplicación de prueba

Hago una aplicación de prueba Muestra el ganador ahora si el número de preguntas caduca y cuenta los puntos, pero quiero que en caso de que los puntos sean iguales muestre un mensaje

 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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!