I do not know how to implement it.
There is a code that should output in a row 3 random words without repetitions. It works, but how to make a word in front of you add a permanent description, for example:
1 gray: bear
2 white: hare
3 brown: fox
It is necessary that only the names of animals change, the list of colors is always the same. Here, for example, 5 words, but their number may be different. `
If not difficult, can you explain in more detail?
'use strict'; var numWords = 3, words = ["Π²ΠΎΠ»ΠΊ ","Π»ΠΈΡΠ° ","Π·Π°ΡΡ ","ΠΌΠ΅Π΄Π²Π΅Π΄Ρ ","Π΅ΠΆΠΈΠΊ "]; var rand = function(from, to) { var n = Math.floor((to - from + 1) * (Math.random() %100)); return (from + n); } var newWords = words; var loops = (words.length - numWords); for (var i = 0; i < loops; i++) { newWords.splice(rand(0, words.length - 1), 1); } console.log(newWords.join(''));