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

[Codewars] Jenny's secret message (8 kyu) / JavaScript

by fluss 2023. 1. 28.

https://www.codewars.com/kata/55225023e1be1ec8bc000390

 

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:

Jenny has written a function that returns a greeting for a user. However, she's in love with Johnny, and would like to greet him slightly different. She added a special case to her function, but she made a mistake.

Can you help her?

 

코드

function greet(name){
  if(name === "Johnny")
    return "Hello, my love!";
  return "Hello, " + name + "!";
}

댓글