Решение через функцию:
//** mdate: [object Date] **//
function checkAge(mdate) {
var age = mdate.getFullYear()-1995;
var prefixes = {
"0": "лет",
"1": "год",
"2": "года",
"3": "года",
"4": "года",
"5": "лет",
"6": "лет",
"7": "лет",
"8": "лет",
"9": "лет"
};
if (age >= 11 && age <= 14) {
document.write(age + " " + "лет");
return;
}
var strAge = age + "";
var lastNum = strAge.slice(strAge.length-1);
document.write(age + " " + prefixes[lastNum]);
}