[].filter
. Решается примерно так: https://mihaly4.ru/plural-ili-mnozhestvennoe-chisl... const colors = ['blue', 'green', 'red', 'orange', 'violet', 'indigo'];
const suffixes = ['th', 'st', 'nd', 'rd'];
const choices = colors.map((color, index) => {
const suffix = index < 4 ? suffixes[index] : suffixes[index % 4];
return `${index + 1}${suffix} choice is ${color}`;
});
console.log(choices);