https://www.codewars.com/kata/55a70521798b14d4750000a4/javascript
Codewars - Achieve mastery through coding practice and developer mentorship
Coding practice 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:
Make a function that will return a greeting statement that uses an input; your program should return, "Hello, <name> how are you doing today?".
[Make sure you type the exact thing I wrote or the program may not execute properly]
설명:
입력을 이용해서 인사말을 반환하는 함수를 만드세요. 프로그램은 "Hello, how are you doing today?"을 반환해야 합니다.
[작성한 내용을 정확하게 입력했는 지 확인하세요. 그렇지 않으면 프로그램이 제대로 실행되지 않을 수 있습니다.]
풀이
function greet(name){
return `Hello, ${name} how are you doing today?`
}
템플릿 리터럴을 이용해서 풀었다.
참고
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Template_literals
Template literals - JavaScript | MDN
템플릿 리터럴은 내장된 표현식을 허용하는 문자열 리터럴입니다. 여러 줄로 이뤄진 문자열과 문자 보간기능을 사용할 수 있습니다. 이전 버전의 ES2015사양 명세에서는 "template strings" (템플릿 문
developer.mozilla.org
'알고리즘 > Codewars' 카테고리의 다른 글
[Codewars] Sentence Smash (8 kyu) / JavaScript (0) | 2022.10.17 |
---|---|
[Codewars] Your order, please (6 kyu) / JavaScript (1) | 2022.10.14 |
[Codewars] Are they the "same"? (6 kyu) / JavaScript (0) | 2022.10.13 |
[Codewars] Number of People in the Bus (7 kyu) / JavaScript (0) | 2022.10.13 |
[Codewars] Return Negative (8 kyu) / JavaScript (0) | 2022.10.12 |
댓글