본문 바로가기
알고리즘/Codewars

[Codewars] Grasshopper - Messi goals function (8 kyu) / JavaScript

by fluss 2023. 5. 5.

https://www.codewars.com/kata/55f73be6e12baaa5900000d4

 

Codewars - Achieve mastery through coding practice and developer mentorship

A coding practice website for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages!

www.codewars.com

 

DESCRIPTION:

Messi goals function

Messi is a soccer player with goals in three leagues:

  • LaLiga
  • Copa del Rey
  • Champions

Complete the function to return his total number of goals in all three leagues.

Note: the input will always be valid.

For example:

5, 10, 2  -->  17
 

코드

function goals (laLigaGoals, copaDelReyGoals, championsLeagueGoals) {
  return laLigaGoals + copaDelReyGoals + championsLeagueGoals;
}

댓글