https://www.codewars.com/kata/586c1cf4b98de0399300001d
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:
Create a combat function that takes the player's current health and the amount of damage recieved, and returns the player's new health. Health can't be less than 0.
코드
function combat(health, damage) {
let result = health - damage;
return result < 0 ? 0 : result;
}
'알고리즘 > Codewars' 카테고리의 다른 글
[Codewars] Sum The Strings (8 kyu) / JavaScript (0) | 2023.03.24 |
---|---|
[Codewars] Form The Minimum (7 kyu) / JavaScript (0) | 2023.03.23 |
[Codewars] Is the string uppercase? (8 kyu) / JavaScript / Python (0) | 2023.03.21 |
[Codewars] Vowel remover (8 kyu) / JavaScript (0) | 2023.03.20 |
[Codewars] Find the position! (8 kyu) / JavaScript (0) | 2023.03.19 |
댓글