Programma che scrive 2 parole casuali a schermo
Script function getRandomInt(max) { return Math.floor(Math.random() * Math.floor(max)); } function generateRandomWords(length) { var wordList = [ "dog", "cat", "elephant", "bird", "cow", "pig", "fox", "mouse", "lion", "tiger", "bear", "seal" ]; var randomWords = []; for (var i = 0; i < length; i++) { randomWords.push(wordList[getRandomInt(wordList.length)]); } return randomWords; } console.log(generateRandomWords(3));