https://www.codewars.com/kata/52ceafd1f235ce81aa00073a
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:
We need a simple function that determines if a plural is needed or not. It should take a number, and return true if a plural should be used with that number or false if not. This would be useful when printing out a string such as 5 minutes, 14 apples, or 1 sun.
You only need to worry about english grammar rules for this kata, where anything that isn't singular (one of something), it is plural (not one of something).
All values will be positive integers or floats, or zero.
코드
function plural(n) {
return n !== 1;
}
'알고리즘 > Codewars' 카테고리의 다른 글
[Codewars] The highest profit wins! (7 kyu) / JavaScript (0) | 2023.02.07 |
---|---|
[Codewars] Quarter of the year (8 kyu) / JavaScript (0) | 2023.02.06 |
[Codewars] Will there be enough space? (8 kyu) / JavaScript (0) | 2023.02.04 |
[Codewars] Simple Fun #176: Reverse Letter (7 kyu) / JavaScript (0) | 2023.02.03 |
[Codewars] Count characters in your string (6 kyu) / JavaScript (0) | 2023.02.02 |
댓글