javascript random word
// function for selecting a random index from an array const pickOne = (arr) => arr[Math.floor(Math.random() * arr.length)]; let choice = pickOne(["Apple", "Banana", "Orange"]);
random word js
var word = ['Rock', 'Paper', 'Scissor']; var words = word[Math.floor(Math.random()*word.length)]; alert('The computer chose:' + words); // Be sure to add more to the string values if you wish to add more words.