Quantidade total de pontos

/*
  Our football team finished the championship. 
  The result of each match look like "x:y". 
  Results of all matches are recorded in the collection.

  For example: ["3:1", "2:2", "0:1", ...]

  Write a function that takes such collection and counts the points of our team in 
  the championship. Rules for counting points for each match:

  if x > y: 3 points
  if x < y: 0 point
  if x = y: 1 point
*/

const points = games => {
  return games.map(game => {
    const [a, b] = game.split(':')
    return a > b ? 3 : a === b ? 1 : 0
  }).reduce((acc, cur) => acc + cur, 0)
}

 	// OR

const points = games => {
  let points = 0
  games.forEach(game => {
    const [a, b] = game.split(':')
    a > b ? points+=3 : a === b ? points+=1 : points+=0
  })
  return points
}

// With love @kouqhar
kouqhar