fn=(n, arr) => n+" "+arr[(n%100>4 && n%100<20)?2:[2, 0, 1, 1, 1, 2][(n%10<5)?n%10:5]]; var arr1 = ['год', 'года', 'лет']; alert(fn(100, arr1));