Created
April 2, 2017 16:39
-
-
Save temazinkin/16841e8cd3a36efcce2ba7e5bb44850e to your computer and use it in GitHub Desktop.
Числительные. Склонение слов на javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function declOfNum(number, titles) { | |
cases = [2, 0, 1, 1, 1, 2]; | |
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ]; | |
} | |
declOfNum(count, ['найдена', 'найдено', 'найдены']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment