var days = 12;
var string = String(days).slice(-1);
var num = Number(string);
var text = '';
switch(num) {
case 1:
text = 'день';break;
case 2:
text = 'дня' ;break;
case 3:
text = 'дня' ;break;
case 4:
text = 'дня' ;break;
default:
text = 'дней';break;
}
if(days==11||days==12||days==13||days==14){ text = 'дней';}
console.log( days+text );