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

[Codewars] Keep up the hoop (8 kyu) / JavaScript

by fluss 2023. 3. 2.

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

 

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:

Alex just got a new hula hoop, he loves it but feels discouraged because his little brother is better than him

Write a program where Alex can input (n) how many times the hoop goes round and it will return him an encouraging message :)

  • If Alex gets 10 or more hoops, return the string "Great, now move on to tricks".
  • If he doesn't get 10 hoops, return the string "Keep at it until you get it".

 

코드

function hoopCount (n) {
   return n >= 10 ? "Great, now move on to tricks" : "Keep at it until you get it"; 
}

댓글