Skip to content

Instantly share code, notes, and snippets.

@ar7n
Created July 1, 2015 16:34
Show Gist options
  • Save ar7n/243bcf764a5e457fa1d0 to your computer and use it in GitHub Desktop.
Save ar7n/243bcf764a5e457fa1d0 to your computer and use it in GitHub Desktop.
Russian plurals in js
function plural(number, one, two, five) {
var number = Math.abs(number);
number %= 100;
if (number >= 5 && number <= 20) {
return five;
}
number %= 10;
if (number == 1) {
return one;
}
if (number >= 2 && number <= 4) {
return two;
}
return five;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment