getCentury = Math.floor((year - 1) / 100) + 1;
let result = String(getCentury);
if (result.charAt(1) === "1") {
result += "st";
}
if (result.charAt(1) === "2") {
result += "nd";
}
if (result.charAt(1) === "3") {
result += "rd";
} else {
result += "th";
}
return result;
}
expected '21stth' to equal '21st'
а что за charAt?
Обсуждают сегодня