0
Add a button and allow a random value to appear in the text box
I feel like I should not bother the people in Stack Overflow too much. So, I am creating a Mad-Libs type thing where the user can input the values. But, what if the user does not know what to put? I'd like to add a button and when the user clicks on it, it will show one value of an array. Thanks for your help!
2 Answers
0
I'm a noob in JavaScript but I guess this could work:
var Responses = [
"Yes",
"No",
];
getRandom = (array) => {return array[Math.floor(Math.random() * array.length)];}
console.log(getRandom(Responses));
0
What have you done so far?