Last active
December 1, 2018 12:44
-
-
Save RiodeJaneiroo/b336fb149185abefb09216f715b349fe to your computer and use it in GitHub Desktop.
[Склонение числительных javascript] #js #javascript
This file contains hidden or 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(n, titles) { | |
| return titles[(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)]; | |
| } | |
| /* | |
| use: declOfNum(count, ['найдена', 'найдено', 'найдены']); | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment