Skip to content

Instantly share code, notes, and snippets.

@arslanbekov
Created December 3, 2014 09:17
Show Gist options
  • Save arslanbekov/fa152e1c7fce889a725c to your computer and use it in GitHub Desktop.
Save arslanbekov/fa152e1c7fce889a725c to your computer and use it in GitHub Desktop.
Склонение чисел
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] ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment