Answers for "javascript random word"

1

js random word generator

var word = ['Rock', 'Paper', 'Scissor'];
var words = word[Math.floor(Math.random()*word.length)];
alert('The computer chose:' + word);

// Be sure to add more to the string values if you wish to add more words.
Posted by: Guest on March-12-2021
1

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"]);
Posted by: Guest on May-31-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language