The function receives an array with the results of the football championship matches of a team in this format ["3:1", "2:2", "0:1", ...]. The function must calculate and return how many points the team got taking into account: //that its result is the first in each string // a match won adds 3 points, a tie adds 1 point, and losing 0!
I share my code, (it's incomplete, I'm missing the situation in which the team ties and loses) but I don't know how to ask with the if what is the largest number and save it in my earnedpoints variable.
function puntosDelEquipo(array) {
var puntosGanados = 0;
for (var i = 0; i < array.split(":").length; i++) {
if (array[i][0] > array[i][1]) {
puntosGanados = puntosGanados.push(array[i + 3]) {}
}
return puntosGanados;
}
}